chore: enable multiple thread of collab-rt crate (#484)
This commit is contained in:
parent
1515ccdb80
commit
0de64f4f71
|
|
@ -191,7 +191,7 @@ dashmap = "5.5.3"
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
async-stream = "0.3.5"
|
async-stream = "0.3.5"
|
||||||
reqwest = "0.11.27"
|
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"
|
lazy_static = "1.4.0"
|
||||||
tonic = "0.11"
|
tonic = "0.11"
|
||||||
prost = "0.12"
|
prost = "0.12"
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,6 @@ where
|
||||||
for yrs_message in reader {
|
for yrs_message in reader {
|
||||||
let msg = yrs_message?;
|
let msg = yrs_message?;
|
||||||
let is_server_sync_step_1 = matches!(msg, Message::Sync(SyncMessage::SyncStep1(_)));
|
let is_server_sync_step_1 = matches!(msg, Message::Sync(SyncMessage::SyncStep1(_)));
|
||||||
|
|
||||||
if let Some(return_payload) =
|
if let Some(return_payload) =
|
||||||
handle_message_follow_protocol(&message_origin, &ClientSyncProtocol, &mut collab, msg)?
|
handle_message_follow_protocol(&message_origin, &ClientSyncProtocol, &mut collab, msg)?
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,4 @@ lazy_static = "1.4.0"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
multi-thread = []
|
collab-rt-multi-thread = []
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ where
|
||||||
metrics: Arc<CollabRealtimeMetrics>,
|
metrics: Arc<CollabRealtimeMetrics>,
|
||||||
command_recv: RTCommandReceiver,
|
command_recv: RTCommandReceiver,
|
||||||
) -> Result<Self, RealtimeError> {
|
) -> Result<Self, RealtimeError> {
|
||||||
if cfg!(feature = "multi-thread") {
|
if cfg!(feature = "collab-rt-multi-thread") {
|
||||||
info!("CollaborationServer with multi-thread feature enabled");
|
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
|
/// 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
|
/// single-threaded Tokio runtime. To circumvent this limitation and enable task execution across
|
||||||
/// multiple threads, we've incorporated a multi-thread feature.
|
/// 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>
|
pub(crate) fn rt_spawn<T>(future: T) -> tokio::task::JoinHandle<T::Output>
|
||||||
where
|
where
|
||||||
T: Future + Send + 'static,
|
T: Future + Send + 'static,
|
||||||
|
|
@ -258,7 +258,7 @@ where
|
||||||
COLLAB_RUNTIME.spawn(future)
|
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>
|
pub(crate) fn rt_spawn<T>(future: T) -> tokio::task::JoinHandle<T::Output>
|
||||||
where
|
where
|
||||||
T: Future + 'static,
|
T: Future + 'static,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue