mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-23 01:16:30 +00:00
comments
This commit is contained in:
@@ -149,7 +149,10 @@ impl Client {
|
||||
let mut proxy = pool.get().await.unwrap();
|
||||
let server = &mut *proxy;
|
||||
|
||||
// TODO: maybe don't do this, I don't think it's useful.
|
||||
server.set_name(&self.name).await?;
|
||||
|
||||
// Claim this server as mine for query cancellation.
|
||||
server.claim(self.process_id, self.secret_key);
|
||||
|
||||
loop {
|
||||
@@ -280,6 +283,7 @@ impl Client {
|
||||
}
|
||||
}
|
||||
|
||||
/// Release the server from being mine. I can't cancel its queries anymore.
|
||||
pub fn release(&mut self) {
|
||||
let mut guard = self.client_server_map.lock().unwrap();
|
||||
guard.remove(&(self.process_id, self.secret_key));
|
||||
|
||||
@@ -305,6 +305,7 @@ impl Server {
|
||||
self.bad = true;
|
||||
}
|
||||
|
||||
/// Claim this server as mine for the purposes of query cancellation.
|
||||
pub fn claim(&mut self, process_id: i32, secret_key: i32) {
|
||||
let mut guard = self.client_server_map.lock().unwrap();
|
||||
guard.insert((process_id, secret_key), (self.backend_id, self.secret_key));
|
||||
|
||||
Reference in New Issue
Block a user