This commit is contained in:
Mateusz Gruszczyński committed 2026-10-03 10:05:46 +02:00
1 parent 5e23e9af02
commit 3883a21bc4
56 files changed
+1640 -403

No files matched your search

+13
View File
@@ -210,6 +210,19 @@ impl Cache {
.proactive_scheduled_keys
.lock()
.unwrap_or_else(|e| e.into_inner());
// Each scheduled key owns a sleeping Tokio task plus refresh context.
// Bound the pending set independently from the cache entry count so a
// large cache with long TTLs cannot turn into thousands of resident tasks.
let pending_limit = settings
.proactive_refresh_max_inflight
.saturating_mul(64)
.clamp(64, 256);
if scheduled.len() >= pending_limit && !scheduled.contains(&ticket.key) {
self.counters
.proactive_skipped
.fetch_add(1, Ordering::Relaxed);
return None;
}
if !scheduled.insert(ticket.key) {
return None;
}