mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-12-09 21:55:57 +08:00
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:
parent
7b81878a49
commit
d1765b6f58
1 changed files with 5 additions and 0 deletions
|
|
@ -185,6 +185,11 @@ func (c *cloudnsProvider) createDomain(domain string) error {
|
||||||
if _, err := c.get("/dns/register.json", params); err != nil {
|
if _, err := c.get("/dns/register.json", params); err != nil {
|
||||||
return fmt.Errorf("failed create domain (ClouDNS): %w", err)
|
return fmt.Errorf("failed create domain (ClouDNS): %w", err)
|
||||||
}
|
}
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
|
if c.domainIndex != nil {
|
||||||
|
c.domainIndex[domain] = domain
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue