mirror of
https://github.com/mikedilger/chorus.git
synced 2026-05-03 06:51:42 +00:00
possible fix on shutdown (use interval not sleep)
This commit is contained in:
parent
9c7c92acd0
commit
5311314fce
@ -143,8 +143,8 @@ async fn main() -> Result<(), Error> {
|
|||||||
log::info!("Waiting for {num_clients} websockets to shutdown...");
|
log::info!("Waiting for {num_clients} websockets to shutdown...");
|
||||||
|
|
||||||
// We will check if all clients have shutdown every 25ms
|
// We will check if all clients have shutdown every 25ms
|
||||||
let sleep = tokio::time::sleep(Duration::from_millis(25));
|
let interval = tokio::time::interval(Duration::from_millis(25));
|
||||||
tokio::pin!(sleep);
|
tokio::pin!(interval);
|
||||||
|
|
||||||
while num_clients != 0 {
|
while num_clients != 0 {
|
||||||
// If we get another shutdown signal, stop waiting for websockets
|
// If we get another shutdown signal, stop waiting for websockets
|
||||||
@ -158,7 +158,7 @@ async fn main() -> Result<(), Error> {
|
|||||||
v = terminate_signal.recv() => if v.is_some() {
|
v = terminate_signal.recv() => if v.is_some() {
|
||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
() = &mut sleep => {
|
_instant = interval.tick() => {
|
||||||
num_clients = GLOBALS.num_clients.load(Ordering::Relaxed);
|
num_clients = GLOBALS.num_clients.load(Ordering::Relaxed);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user