diff options
author | Joe Rayhawk <jrayhawk@action.fairlystable.org> | 2020-10-24 23:49:48 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@action.fairlystable.org> | 2020-10-24 23:49:48 -0700 |
commit | 2cf41f470cbc4318c8d2ef72e7fcaa29277e6356 (patch) | |
tree | e2fde53df7413a652ba2f697099e3ee3a86f265a | |
parent | 97c900005f549a04787516f67ecfa60890c7b550 (diff) | |
download | twitch-irc.tar.gz twitch-irc.zip |
Update to match Crystal's newer Time APIirc
-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 |