mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-27 18:56:30 +00:00
Mark admin clients as disconnected on error (#597)
This commit is contained in:
@@ -155,10 +155,10 @@ pub async fn client_entrypoint(
|
|||||||
|
|
||||||
if !client.is_admin() {
|
if !client.is_admin() {
|
||||||
let _ = drain.send(-1).await;
|
let _ = drain.send(-1).await;
|
||||||
|
}
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
client.stats.disconnect();
|
client.stats.disconnect();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
@@ -207,10 +207,10 @@ pub async fn client_entrypoint(
|
|||||||
|
|
||||||
if !client.is_admin() {
|
if !client.is_admin() {
|
||||||
let _ = drain.send(-1).await;
|
let _ = drain.send(-1).await;
|
||||||
|
}
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
client.stats.disconnect();
|
client.stats.disconnect();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
@@ -261,10 +261,10 @@ pub async fn client_entrypoint(
|
|||||||
|
|
||||||
if !client.is_admin() {
|
if !client.is_admin() {
|
||||||
let _ = drain.send(-1).await;
|
let _ = drain.send(-1).await;
|
||||||
|
}
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
client.stats.disconnect();
|
client.stats.disconnect();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
@@ -290,11 +290,12 @@ pub async fn client_entrypoint(
|
|||||||
|
|
||||||
if !client.is_admin() {
|
if !client.is_admin() {
|
||||||
let _ = drain.send(-1).await;
|
let _ = drain.send(-1).await;
|
||||||
|
|
||||||
if result.is_err() {
|
|
||||||
client.stats.disconnect();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if result.is_err() {
|
||||||
|
client.stats.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1811,7 +1812,6 @@ impl<S, T> Drop for Client<S, T> {
|
|||||||
|
|
||||||
// Dirty shutdown
|
// Dirty shutdown
|
||||||
// TODO: refactor, this is not the best way to handle state management.
|
// TODO: refactor, this is not the best way to handle state management.
|
||||||
|
|
||||||
if self.connected_to_server && self.last_server_stats.is_some() {
|
if self.connected_to_server && self.last_server_stats.is_some() {
|
||||||
self.last_server_stats.as_ref().unwrap().idle();
|
self.last_server_stats.as_ref().unwrap().idle();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user