From 2cf41f470cbc4318c8d2ef72e7fcaa29277e6356 Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Sat, 24 Oct 2020 23:49:48 -0700 Subject: Update to match Crystal's newer Time API --- src/twitch/rate_limiter.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3