fix: try to fix potential cpu issue (#308)
This commit is contained in:
parent
b1c14c8ffb
commit
09664b0aaa
|
|
@ -483,6 +483,9 @@ impl CollabClientStream {
|
||||||
if can_sink {
|
if can_sink {
|
||||||
// Send the message to websocket client actor
|
// Send the message to websocket client actor
|
||||||
client_ws_sink.do_send(msg.into());
|
client_ws_sink.do_send(msg.into());
|
||||||
|
} else {
|
||||||
|
// when then client is not allowed to receive the message
|
||||||
|
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -496,6 +499,9 @@ impl CollabClientStream {
|
||||||
while let Some(Ok(Ok(RealtimeMessage::Collab(msg)))) = stream_rx.next().await {
|
while let Some(Ok(Ok(RealtimeMessage::Collab(msg)))) = stream_rx.next().await {
|
||||||
if stream_filter(&cloned_object_id, &msg).await {
|
if stream_filter(&cloned_object_id, &msg).await {
|
||||||
let _ = tx.send(Ok(msg)).await;
|
let _ = tx.send(Ok(msg)).await;
|
||||||
|
} else {
|
||||||
|
// when then client is not allowed to receive the message
|
||||||
|
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue