From: Chris Hofstaedtler Date: Fri, 3 Dec 2021 12:52:38 +0000 (+0100) Subject: auth API: add zone to zonecache in flush endpoint X-Git-Tag: auth-4.6.0-beta1~4^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11066%2Fhead;p=thirdparty%2Fpdns.git auth API: add zone to zonecache in flush endpoint --- 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 {