prune expired system proxy cache entries

This commit is contained in:
canvrno-oai
2026-06-02 10:14:36 -07:00
parent a05585d188
commit d35be4e962
+3 -1
View File
@@ -347,11 +347,13 @@ fn cache_system_proxy_decision(
) {
let cache = SYSTEM_PROXY_CACHE.get_or_init(|| Mutex::new(HashMap::new()));
if let Ok(mut cache) = cache.lock() {
let now = Instant::now();
cache.retain(|_, cached| cached.expires_at > now);
cache.insert(
system_proxy_cache_key(request_url, include_auto_detect),
CachedSystemProxyDecision {
decision,
expires_at: Instant::now() + SYSTEM_PROXY_CACHE_TTL,
expires_at: now + SYSTEM_PROXY_CACHE_TTL,
},
);
}