fix: deduplicate background refresh with per-domain guard

Multiple stale queries for the same domain now spawn only one background
refresh. A HashSet<(String, QueryType)> on ServerCtx tracks in-flight
refreshes; subsequent stale hits for the same key skip the spawn.
This commit is contained in:
Razvan Dimescu
2026-04-12 19:49:23 +03:00
parent 8ef95383a2
commit 3c49b0e65d
4 changed files with 15 additions and 4 deletions

View File

@@ -285,6 +285,7 @@ async fn main() -> numa::Result<()> {
config.cache.min_ttl,
config.cache.max_ttl,
)),
refreshing: Mutex::new(std::collections::HashSet::new()),
stats: Mutex::new(ServerStats::new()),
overrides: RwLock::new(OverrideStore::new()),
blocklist: RwLock::new(blocklist),