HEDNS: Adopt diff2 in compatibility mode (#1887)

This commit is contained in:
Tom Limoncelli 2023-01-02 08:25:23 -05:00 committed by GitHub
parent e0fef398be
commit f8fd853a02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,10 +205,14 @@ func (c *hednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models
txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
var corrections []*models.Correction
if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
var toCreate, toDelete, toModify diff.Changeset
if !diff2.EnableDiff2 {
differ := diff.New(dc)
_, toCreate, toDelete, toModify, err := differ.IncrementalDiff(prunedRecords)
_, toCreate, toDelete, toModify, err = differ.IncrementalDiff(prunedRecords)
} else {
differ := diff.NewCompat(dc)
_, toCreate, toDelete, toModify, err = differ.IncrementalDiff(prunedRecords)
}
if err != nil {
return nil, err
}
@ -248,11 +252,6 @@ func (c *hednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models
})
}
return corrections, err
}
// Insert Future diff2 version here.
return corrections, nil
}