Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Remove non-determinism caused by random entropy when reconnecting

Antonio Scandurraf0a721032d70
diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs
index bad85384be6..c75aef3a1ad 100644
--- a/crates/client/src/client.rs
+++ b/crates/client/src/client.rs
@@ -398,7 +398,11 @@ impl Client {
let this = self.clone();
let reconnect_interval = state.reconnect_interval;
state._reconnect_task = Some(cx.spawn(|cx| async move {
+ #[cfg(any(test, feature = "test-support"))]
+ let mut rng = StdRng::seed_from_u64(0);
+ #[cfg(not(any(test, feature = "test-support")))]
let mut rng = StdRng::from_entropy();
+
let mut delay = INITIAL_RECONNECTION_DELAY;
while let Err(error) = this.authenticate_and_connect(true, &cx).await {
log::error!("failed to connect {}", error);