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

@@ -1012,6 +1012,7 @@ mod tests {
socket,
zone_map: std::collections::HashMap::new(),
cache: RwLock::new(crate::cache::DnsCache::new(100, 60, 86400)),
refreshing: Mutex::new(std::collections::HashSet::new()),
stats: Mutex::new(crate::stats::ServerStats::new()),
overrides: RwLock::new(crate::override_store::OverrideStore::new()),
blocklist: RwLock::new(crate::blocklist::BlocklistStore::new()),