Skip to content

Commit d8889c6

Browse files
authored
Do not do double check on connection num when entering graceful shutdown (#309)
1 parent fdac52a commit d8889c6

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

actix-server/src/worker.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,12 @@ impl Future for ServerWorker {
353353
return Poll::Ready(());
354354
} else if graceful {
355355
self.shutdown(false);
356-
let num = num_connections();
357-
if num != 0 {
358-
info!("Graceful worker shutdown, {} connections", num);
359-
self.state = WorkerState::Shutdown(
360-
Box::pin(sleep(Duration::from_secs(1))),
361-
Box::pin(sleep(self.config.shutdown_timeout)),
362-
Some(result),
363-
);
364-
} else {
365-
let _ = result.send(true);
366-
return Poll::Ready(());
367-
}
356+
info!("Graceful worker shutdown, {} connections", num);
357+
self.state = WorkerState::Shutdown(
358+
Box::pin(sleep(Duration::from_secs(1))),
359+
Box::pin(sleep(self.config.shutdown_timeout)),
360+
Some(result),
361+
);
368362
} else {
369363
info!("Force shutdown worker, {} connections", num);
370364
self.shutdown(true);

0 commit comments

Comments
 (0)