Skip to content

Commit 2ab708c

Browse files
committed
minor cleanup
1 parent 6ed7298 commit 2ab708c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

postgres/src/client.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,16 @@ impl Client {
414414
self.connection.block_on(self.client.simple_query(query))
415415
}
416416

417-
/// Validates connection, timing out after specified duration.
417+
/// Validates the connection by performing a simple no-op query.
418+
///
419+
/// If the specified timeout is reached before the backend responds, an error will be returned.
418420
pub fn is_valid(&mut self, timeout: Duration) -> Result<(), Error> {
419421
let inner_client = &self.client;
420422
self.connection.block_on(async {
421423
let trivial_query = inner_client.simple_query("");
422424
tokio::time::timeout(timeout, trivial_query)
423425
.await
424-
.map_err(|_| Error::timeout())?
426+
.map_err(|_| Error::__private_api_timeout())?
425427
.map(|_| ())
426428
})
427429
}

tokio-postgres/src/error/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl Error {
495495
}
496496

497497
#[doc(hidden)]
498-
pub fn timeout() -> Error {
498+
pub fn __private_api_timeout() -> Error {
499499
Error::new(Kind::Timeout, None)
500500
}
501501
}

0 commit comments

Comments
 (0)