Skip to content

Commit d97cf2f

Browse files
committed
Expose the backend PID on the client
So that clients can observe the ID of their connection without a network roundtrip.
1 parent 91522e4 commit d97cf2f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tokio-postgres/src/client.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ impl Client {
544544
TransactionBuilder::new(self)
545545
}
546546

547+
/// Returns the server's process ID for the connection.
548+
pub fn backend_pid(&self) -> i32 {
549+
self.process_id
550+
}
551+
547552
/// Constructs a cancellation token that can later be used to request cancellation of a query running on the
548553
/// connection associated with this client.
549554
pub fn cancel_token(&self) -> CancelToken {

0 commit comments

Comments
 (0)