diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-09 15:45:01 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-12 15:07:25 -0800 |
commit | 8b939bfab769810ba56f5f4ca18632fd7ae435db (patch) | |
tree | fcde1e78639873980fc6a0ef944df191445a4e30 /lib | |
parent | ef78f67f4a2e19d204f5f4d4770649be1fe7bee9 (diff) | |
download | gitlab-ce-8b939bfab769810ba56f5f4ca18632fd7ae435db.tar.gz |
Add spec for ActionRateLimiter
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/action_rate_limiter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/action_rate_limiter.rb b/lib/gitlab/action_rate_limiter.rb index c3af583a3ed..7b231ac14ca 100644 --- a/lib/gitlab/action_rate_limiter.rb +++ b/lib/gitlab/action_rate_limiter.rb @@ -16,12 +16,12 @@ module Gitlab value = 0 Gitlab::Redis::Cache.with do |redis| - cache_key = "action_rate_limiter:#{action}:#{key}" + cache_key = "action_rate_limiter:#{action.to_s}:#{key}" value = redis.incr(cache_key) redis.expire(cache_key, expiry_time) if value == 1 end - value.to_i + value end def throttled?(key, threshold_value) |