Removed excessive variable n, and multiplying by time.Second.

This commit is contained in:
Alexander Andreev 2022-06-26 20:36:36 +04:00
parent 0c1972461e
commit be4050d1f5
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -36,8 +36,7 @@ func (cdb *CaptchaDB) SetExpiration(expire time.Duration) {
go func() { go func() {
for { for {
n := time.Now().Second() sleepFor := expiredScanInterval - (time.Duration(time.Now().Second()) % expiredScanInterval)
sleepFor := expiredScanInterval - (time.Duration(n) * time.Second % expiredScanInterval)
time.Sleep(sleepFor) time.Sleep(sleepFor)
for id, captcha := range cdb.DB { for id, captcha := range cdb.DB {