Skip to content

Commit 968842c

Browse files
committed
io_loop: don't flood reconnection attempts too much
1 parent 4481e57 commit 968842c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/io_loop.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::{
2626
thread::Builder as ThreadBuilder,
2727
time::Duration,
2828
};
29-
use tracing::{Level, error, trace};
29+
use tracing::{Level, debug, error, trace};
3030

3131
const FRAMES_STORAGE: usize = 32;
3232

@@ -231,6 +231,11 @@ impl<
231231
break (stream, res);
232232
}
233233

234+
// FIXME: make this configurable and/or smarter?
235+
let throttle = 1000;
236+
debug!("Throttling {}ms before reconnection to avoid flooding", throttle);
237+
std::thread::sleep(std::time::Duration::from_millis(throttle));
238+
234239
self.reset();
235240
self.socket_state.reset();
236241
self.internal_rpc.start_channels_recovery();

0 commit comments

Comments
 (0)