mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-25 18:06:29 +00:00
Fix maxwait metric (#183)
Max wait was being reported as 0 after #159 This PR fixes that and adds test
This commit is contained in:
committed by
GitHub
parent
7987c5ffad
commit
3d33ccf4b0
@@ -333,7 +333,6 @@ impl ConnectionPool {
|
||||
role: Option<Role>, // primary or replica
|
||||
process_id: i32, // client id
|
||||
) -> Result<(PooledConnection<'_, ServerPool>, Address), Error> {
|
||||
let now = Instant::now();
|
||||
let mut candidates: Vec<&Address> = self.addresses[shard]
|
||||
.iter()
|
||||
.filter(|address| address.role == role)
|
||||
@@ -358,6 +357,7 @@ impl ConnectionPool {
|
||||
}
|
||||
|
||||
// Indicate we're waiting on a server connection from a pool.
|
||||
let now = Instant::now();
|
||||
self.stats.client_waiting(process_id);
|
||||
|
||||
// Check if we can connect
|
||||
@@ -397,7 +397,7 @@ impl ConnectionPool {
|
||||
|
||||
match tokio::time::timeout(
|
||||
tokio::time::Duration::from_millis(healthcheck_timeout),
|
||||
server.query(";"), // Cheap query (query parser not used in PG)
|
||||
server.query(";"), // Cheap query as it skips the query planner
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user