mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
better error message, actually clear unused cached lookups.
This commit is contained in:
@@ -125,11 +125,15 @@ func (c *cache) ResolveErrors() (errs []error) {
|
||||
return
|
||||
}
|
||||
func (c *cache) Save(filename string) error {
|
||||
for _, entry := range c.records {
|
||||
outRecs := make(map[string]*cacheEntry, len(c.records))
|
||||
for k, entry := range c.records {
|
||||
// move resolved data into cached field
|
||||
// only take those we actually resolved
|
||||
if entry.resolvedSPF != "" {
|
||||
entry.SPF = entry.resolvedSPF
|
||||
outRecs[k] = entry
|
||||
}
|
||||
}
|
||||
dat, _ := json.MarshalIndent(c.records, "", " ")
|
||||
dat, _ := json.MarshalIndent(outRecs, "", " ")
|
||||
return ioutil.WriteFile(filename, dat, 0644)
|
||||
}
|
||||
|
Reference in New Issue
Block a user