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
This commit is contained in:
Jakob Ackermann 2025-12-03 14:36:00 +01:00 committed by GitHub
parent 7b81878a49
commit d1765b6f58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}