diff options
-rw-r--r-- | src/twitch/rate_limiter.cr | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/twitch/rate_limiter.cr b/src/twitch/rate_limiter.cr index 929dbc0..7049337 100644 --- a/src/twitch/rate_limiter.cr +++ b/src/twitch/rate_limiter.cr @@ -7,7 +7,7 @@ class RateLimiter(T) @bucket = {} of K => Deque(Time) end - def rate_limited?(key : K, rate_limit_time = Time.now) + def rate_limited?(key : K, rate_limit_time = Time.utc) queue = @bucket[key]? unless queue @@ -30,7 +30,7 @@ class RateLimiter(T) false end - def clean_queue(queue, rate_limit_time = Time.now) + def clean_queue(queue, rate_limit_time = Time.utc) while queue[0] < rate_limit_time queue.shift end |