Skip to content

Commit 62b08c8

Browse files
beneschpetrosagg
authored andcommitted
Expose the backend PID on the client
So that clients can observe the ID of their connection without a network roundtrip.
1 parent b28be2a commit 62b08c8

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
@@ -610,6 +610,11 @@ impl Client {
610610
TransactionBuilder::new(self)
611611
}
612612

613+
/// Returns the server's process ID for the connection.
614+
pub fn backend_pid(&self) -> i32 {
615+
self.process_id
616+
}
617+
613618
/// Constructs a cancellation token that can later be used to request cancellation of a query running on the
614619
/// connection associated with this client.
615620
pub fn cancel_token(&self) -> CancelToken {

0 commit comments

Comments
 (0)