From d1765b6f585018e2dd74af0bb81981ebafb4c100 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 3 Dec 2025 14:36:00 +0100 Subject: [PATCH] CLOUDNS: populate zone cache when creating zone (#3331) Hi @pragmaton! While reviewing all the `ZoneCreator` implementations, I noticed that the CLOUDNS provider has an incomplete caching implementation for zones. The provider is populating the cache once on first access. Any zones that are created will not be readable in the same life-cycle of dnscontrol. This PR is populating the zone cache after creating a zone. Would you mind giving this a try and let me know how it goes? Thanks! Part of https://github.com/StackExchange/dnscontrol/issues/3007 --- providers/cloudns/api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/providers/cloudns/api.go b/providers/cloudns/api.go index 926be5493..5bfd6799e 100644 --- a/providers/cloudns/api.go +++ b/providers/cloudns/api.go @@ -185,6 +185,11 @@ func (c *cloudnsProvider) createDomain(domain string) error { if _, err := c.get("/dns/register.json", params); err != nil { return fmt.Errorf("failed create domain (ClouDNS): %w", err) } + c.Lock() + defer c.Unlock() + if c.domainIndex != nil { + c.domainIndex[domain] = domain + } return nil }