mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-24 04:52:58 +01:00
Do not do double check on connection num when entering graceful shutdown (#309)
This commit is contained in:
parent
fdac52aa11
commit
d8889c63ef
@ -353,18 +353,12 @@ impl Future for ServerWorker {
|
|||||||
return Poll::Ready(());
|
return Poll::Ready(());
|
||||||
} else if graceful {
|
} else if graceful {
|
||||||
self.shutdown(false);
|
self.shutdown(false);
|
||||||
let num = num_connections();
|
info!("Graceful worker shutdown, {} connections", num);
|
||||||
if num != 0 {
|
self.state = WorkerState::Shutdown(
|
||||||
info!("Graceful worker shutdown, {} connections", num);
|
Box::pin(sleep(Duration::from_secs(1))),
|
||||||
self.state = WorkerState::Shutdown(
|
Box::pin(sleep(self.config.shutdown_timeout)),
|
||||||
Box::pin(sleep(Duration::from_secs(1))),
|
Some(result),
|
||||||
Box::pin(sleep(self.config.shutdown_timeout)),
|
);
|
||||||
Some(result),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
let _ = result.send(true);
|
|
||||||
return Poll::Ready(());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
info!("Force shutdown worker, {} connections", num);
|
info!("Force shutdown worker, {} connections", num);
|
||||||
self.shutdown(true);
|
self.shutdown(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user