From 1cfdf406ebd67a3ddb3c19a0261039868d0f1826 Mon Sep 17 00:00:00 2001 From: Vladimir Avtsenov Date: Sat, 14 Sep 2024 19:25:20 +0300 Subject: [PATCH] fix cleanup records --- records.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/records.go b/records.go index 9cb52ee..ee2a76c 100644 --- a/records.go +++ b/records.go @@ -41,7 +41,7 @@ func (r *Records) cleanupARecords(now time.Time) { for name, aRecords := range r.ARecords { i := 0 for _, aRecord := range aRecords { - if aRecord.Deadline.After(now) { + if now.After(aRecord.Deadline) { continue } aRecords[i] = aRecord @@ -56,7 +56,7 @@ func (r *Records) cleanupARecords(now time.Time) { func (r *Records) cleanupCNameRecords(now time.Time) { for name, record := range r.CNameRecords { - if record.Deadline.After(now) { + if now.After(record.Deadline) { delete(r.CNameRecords, name) } } @@ -76,7 +76,7 @@ func (r *Records) getAliasedDomain(now time.Time, domainName string) string { if !ok { break } - if cname.Deadline.After(now) { + if now.After(cname.Deadline) { delete(r.CNameRecords, domainName) break } @@ -93,7 +93,7 @@ func (r *Records) getActualARecords(now time.Time, domainName string) []*ARecord i := 0 for _, aRecord := range aRecords { - if aRecord.Deadline.After(now) { + if now.After(aRecord.Deadline) { continue } aRecords[i] = aRecord