fix(rustproxy): prune stale per-route metrics, add per-route rate limiter caching and regex cache, and improve connection tracking cleanup to prevent memory growth

This commit is contained in:
2026-02-19 08:48:46 +00:00
parent b4b8bd925d
commit 53d73c7dc6
7 changed files with 219 additions and 12 deletions

View File

@@ -27,7 +27,7 @@
pub mod challenge_server;
pub mod management;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use std::time::Instant;
@@ -565,6 +565,12 @@ impl RustProxy {
vec![]
};
// Prune per-route metrics for route IDs that no longer exist
let active_route_ids: HashSet<String> = routes.iter()
.filter_map(|r| r.id.clone())
.collect();
self.metrics.retain_routes(&active_route_ids);
// Atomically swap the route table
let new_manager = Arc::new(new_manager);
self.route_table.store(Arc::clone(&new_manager));