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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user