chore: enable multiple thread of collab-rt crate (#484)

This commit is contained in:
Nathan.fooo 2024-04-21 19:09:16 +08:00 committed by GitHub
parent 1515ccdb80
commit 0de64f4f71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 6 deletions

View File

@ -191,7 +191,7 @@ dashmap = "5.5.3"
futures = "0.3.30"
async-stream = "0.3.5"
reqwest = "0.11.27"
collab-rt = { path = "libs/collab-rt" }
collab-rt = { path = "libs/collab-rt", features = ["collab-rt-multi-thread"] }
lazy_static = "1.4.0"
tonic = "0.11"
prost = "0.12"

View File

@ -226,7 +226,6 @@ where
for yrs_message in reader {
let msg = yrs_message?;
let is_server_sync_step_1 = matches!(msg, Message::Sync(SyncMessage::SyncStep1(_)));
if let Some(return_payload) =
handle_message_follow_protocol(&message_origin, &ClientSyncProtocol, &mut collab, msg)?
{

View File

@ -45,4 +45,4 @@ lazy_static = "1.4.0"
rand = "0.8.5"
[features]
multi-thread = []
collab-rt-multi-thread = []

View File

@ -51,7 +51,7 @@ where
metrics: Arc<CollabRealtimeMetrics>,
command_recv: RTCommandReceiver,
) -> Result<Self, RealtimeError> {
if cfg!(feature = "multi-thread") {
if cfg!(feature = "collab-rt-multi-thread") {
info!("CollaborationServer with multi-thread feature enabled");
}
@ -249,7 +249,7 @@ pub fn default_tokio_runtime() -> io::Result<Runtime> {
/// task execution confines all tasks to the same thread, attributable to the actor's reliance on a
/// single-threaded Tokio runtime. To circumvent this limitation and enable task execution across
/// multiple threads, we've incorporated a multi-thread feature.
#[cfg(feature = "multi-thread")]
#[cfg(feature = "collab-rt-multi-thread")]
pub(crate) fn rt_spawn<T>(future: T) -> tokio::task::JoinHandle<T::Output>
where
T: Future + Send + 'static,
@ -258,7 +258,7 @@ where
COLLAB_RUNTIME.spawn(future)
}
#[cfg(not(feature = "multi-thread"))]
#[cfg(not(feature = "collab-rt-multi-thread"))]
pub(crate) fn rt_spawn<T>(future: T) -> tokio::task::JoinHandle<T::Output>
where
T: Future + 'static,