mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-27 10:46:30 +00:00
Reduce traffic on the stats channel (#69)
This commit is contained in:
@@ -209,23 +209,22 @@ impl ConnectionPool {
|
|||||||
let index = self.round_robin % addresses.len();
|
let index = self.round_robin % addresses.len();
|
||||||
let address = &addresses[index];
|
let address = &addresses[index];
|
||||||
|
|
||||||
self.stats.client_waiting(process_id, address.id);
|
|
||||||
|
|
||||||
// Make sure you're getting a primary or a replica
|
// Make sure you're getting a primary or a replica
|
||||||
// as per request. If no specific role is requested, the first
|
// as per request. If no specific role is requested, the first
|
||||||
// available will be chosen.
|
// available will be chosen.
|
||||||
if address.role != role {
|
if address.role != role {
|
||||||
self.stats.client_disconnecting(process_id, address.id);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
allowed_attempts -= 1;
|
allowed_attempts -= 1;
|
||||||
|
|
||||||
if self.is_banned(address, shard, role) {
|
if self.is_banned(address, shard, role) {
|
||||||
self.stats.client_disconnecting(process_id, address.id);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Indicate we're waiting on a server connection from a pool.
|
||||||
|
self.stats.client_waiting(process_id, address.id);
|
||||||
|
|
||||||
// Check if we can connect
|
// Check if we can connect
|
||||||
let mut conn = match self.databases[shard][index].get().await {
|
let mut conn = match self.databases[shard][index].get().await {
|
||||||
Ok(conn) => conn,
|
Ok(conn) => conn,
|
||||||
|
|||||||
Reference in New Issue
Block a user