Skip to content

Commit

Permalink
log remaining clients after cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Arian8j2 committed Sep 18, 2024
1 parent 7ae7db0 commit a40c338
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions forwarder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ fn cleanup_thread(peer_manager: Arc<RwLock<PeerManager>>) {
/// try cleaning peers that has not been used for about `CLEANUP_INTERVAL` duration.
fn try_cleanup(peer_manager: &RwLock<PeerManager>) {
let mut peers = peer_manager.write();
let mut used_client_count = 0;
for peer in peers.get_all() {
let result = peer
.used
Expand All @@ -175,6 +176,9 @@ fn try_cleanup(peer_manager: &RwLock<PeerManager>) {
let client_addr = peer.get_client_addr();
log::info!("cleaning peer that handled '{client_addr}'");
peers.remove_peer(client_addr, peer.get_token());
} else {
used_client_count += 1;
}
}
log::info!("{used_client_count} clients remaining after cleanup");
}

0 comments on commit a40c338

Please sign in to comment.