Change time.Now().Sub(x) to time.Since(x) for cleanup

Kubernetes-commit: 878548ceac9c109881c379911b8b0d8fce5ea68e
This commit is contained in:
c00522440
2021-04-12 10:27:54 +08:00
committed by Kubernetes Publisher
parent 47b3cad4de
commit ca138c86e8
3 changed files with 3 additions and 3 deletions

View File

@@ -99,7 +99,7 @@ func (d *defaultCacheMutationDetector) Run(stopCh <-chan struct{}) {
for {
if d.lastRotated.IsZero() {
d.lastRotated = time.Now()
} else if time.Now().Sub(d.lastRotated) > d.retainDuration {
} else if time.Since(d.lastRotated) > d.retainDuration {
d.retainedCachedObjs = d.cachedObjs
d.cachedObjs = nil
d.lastRotated = time.Now()