diff options
Diffstat (limited to 'ratelimiter')
-rw-r--r-- | ratelimiter/ratelimiter.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ratelimiter/ratelimiter.go b/ratelimiter/ratelimiter.go index 595e5a5..772c45a 100644 --- a/ratelimiter/ratelimiter.go +++ b/ratelimiter/ratelimiter.go @@ -76,7 +76,7 @@ func (rate *Ratelimiter) Init() { for key, entry := range rate.tableIPv4 { entry.Lock() - if time.Now().Sub(entry.lastTime) > garbageCollectTime { + if time.Since(entry.lastTime) > garbageCollectTime { delete(rate.tableIPv4, key) } entry.Unlock() @@ -84,7 +84,7 @@ func (rate *Ratelimiter) Init() { for key, entry := range rate.tableIPv6 { entry.Lock() - if time.Now().Sub(entry.lastTime) > garbageCollectTime { + if time.Since(entry.lastTime) > garbageCollectTime { delete(rate.tableIPv6, key) } entry.Unlock() |