mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-23 01:16:30 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user