fix(rustproxy): Use cooperative cancellation for background tasks, prune stale caches and metric entries, and switch tests to dynamic port allocation to avoid port conflicts

This commit is contained in:
2026-02-24 20:56:37 +00:00
parent 755c81c042
commit 33cd5330c4
24 changed files with 535 additions and 560 deletions

View File

@@ -131,6 +131,14 @@ impl UpstreamSelector {
}
}
/// Clear stale round-robin counters on route update.
/// Resetting is harmless — counters just restart cycling from index 0.
pub fn reset_round_robin(&self) {
if let Ok(mut counters) = self.round_robin.lock() {
counters.clear();
}
}
fn ip_hash(addr: &SocketAddr) -> usize {
let ip_str = addr.ip().to_string();
let mut hash: usize = 5381;