Patch graceful shutdown bug (#157)

* Fixes non-admin client counting error

* Add log when sigterm received and log number of active clients when shutdown timeout is reached
This commit is contained in:
zain-kabani
2022-09-05 04:02:49 -04:00
committed by GitHub
parent 23a642f4a4
commit 417358c35d
2 changed files with 7 additions and 4 deletions

View File

@@ -204,7 +204,7 @@ pub async fn client_entrypoint(
Ok(mut client) => {
info!("Client {:?} connected (plain)", addr);
if client.is_admin() {
if !client.is_admin() {
let _ = drain.send(1).await;
}
@@ -229,7 +229,7 @@ pub async fn client_entrypoint(
Ok(mut client) => {
info!("Client {:?} issued a cancel query request", addr);
if client.is_admin() {
if !client.is_admin() {
let _ = drain.send(1).await;
}

View File

@@ -221,13 +221,16 @@ async fn main() {
interval.tick().await;
// We're done waiting.
error!("Timed out waiting for clients");
error!("Graceful shutdown timed out. {} active clients being closed", total_clients);
let _ = exit_tx.send(()).await;
});
},
_ = term_signal.recv() => break,
_ = term_signal.recv() => {
info!("Got SIGTERM, closing with {} clients active", total_clients);
break;
},
new_client = listener.accept() => {
let (socket, addr) = match new_client {