Skip to content

Commit 69b0531

Browse files
mxsmCopilot
andauthored
[ISSUE #3538]⚡️Connection count management and resource cleanup delegation (#3539)
* [ISSUE #3538]⚡️Connection count management and resource cleanup delegation * Update rocketmq-store/src/ha/default_ha_connection.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f2ed840 commit 69b0531

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

rocketmq-store/src/ha/default_ha_connection.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,14 @@ impl HAConnection for DefaultHAConnection {
183183
self.close();
184184

185185
// Decrement connection count
186-
//self.ha_service.decrement_connection_count();
186+
let connection_count = self.ha_service.get_connection_count();
187+
if connection_count.load(Ordering::SeqCst) > 0 {
188+
connection_count.fetch_sub(1, Ordering::SeqCst);
189+
}
187190
}
188191

189192
fn close(&self) {
190-
/*let mut socket_guard = self.socket_stream.write().await;
191-
if let Some(mut socket) = socket_guard.take() {
192-
if let Err(e) = socket.shutdown().await {
193-
error!("Error closing socket: {}", e);
194-
}
195-
}*/
193+
//nothing to do here, the socket will be closed by the services
196194
}
197195

198196
fn get_socket(&self) -> &TcpStream {

0 commit comments

Comments
 (0)