From 37b895808504fc594247628c2f26e6bdcd4733a8 Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Fri, 3 Dec 2021 13:52:38 +0100 Subject: [PATCH] auth API: add zone to zonecache in flush endpoint --- pdns/ws-auth.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 5172ac8d69..03ed5c3f13 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -2270,6 +2270,16 @@ static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) { DNSName canon = apiNameToDNSName(req->getvars["domain"]); + if (g_zoneCache.isEnabled()) { + DomainInfo di; + UeberBackend B; + if (B.getDomainInfo(canon, di, false)) { + // zone exists (uncached), add/update it in the zone cache. + // Handle this first, to avoid concurrent queries re-populating the other caches. + g_zoneCache.add(di.zone, di.id); + } + } + // purge entire zone from cache, not just zone-level records. uint64_t count = purgeAuthCaches(canon.toString() + "$"); resp->setJsonBody(Json::object { -- 2.47.2