From 094ebe143e679ac1a709061e0ea6b5f02bf274ba Mon Sep 17 00:00:00 2001 From: molon <3739161+molon@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:49:30 +0800 Subject: [PATCH] use time.Now for Delay/RetryAfter methods --- ratelimiter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ratelimiter.go b/ratelimiter.go index 358ae36..c7bd3d7 100644 --- a/ratelimiter.go +++ b/ratelimiter.go @@ -40,7 +40,7 @@ func (r *Reservation) DelayFrom(t time.Time) time.Duration { } func (r *Reservation) Delay() time.Duration { - return r.DelayFrom(r.Now) + return r.DelayFrom(time.Now()) } func (r *Reservation) RetryAfterFrom(t time.Time) time.Duration { @@ -56,7 +56,7 @@ func (r *Reservation) RetryAfterFrom(t time.Time) time.Duration { } func (r *Reservation) RetryAfter() time.Duration { - return r.RetryAfterFrom(r.Now) + return r.RetryAfterFrom(time.Now()) } type Driver interface {