Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5078c2a

Browse files
committed
Optimize timer reset in fetch method
1 parent 4dfdd4f commit 5078c2a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

coderd/cryptokeys/dbkeycache.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ func (d *DBCache) fetch(ctx context.Context) error {
157157
}
158158

159159
now := d.clock.Now()
160-
d.timer.Stop()
161-
d.timer = d.newTimer()
160+
_ = d.timer.Reset(time.Minute * 10)
162161
d.invalidateAt = now.Add(time.Minute * 10)
163162

164163
cache := make(map[int32]database.CryptoKey)

0 commit comments

Comments
 (0)