Commit 02e7e499 authored by Stan Hu's avatar Stan Hu

Fix Rubocop offense and use a symbol instead of a string

parent 8b939bfa
...@@ -42,7 +42,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController ...@@ -42,7 +42,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
end end
def play def play
limiter = ::Gitlab::ActionRateLimiter.new(action: 'play_pipeline_schedule') limiter = ::Gitlab::ActionRateLimiter.new(action: :play_pipeline_schedule)
if limiter.throttled?(throttle_key, 1) if limiter.throttled?(throttle_key, 1)
flash[:alert] = 'You cannot play this scheduled pipeline at the moment. Please wait a minute.' flash[:alert] = 'You cannot play this scheduled pipeline at the moment. Please wait a minute.'
......
...@@ -16,7 +16,7 @@ module Gitlab ...@@ -16,7 +16,7 @@ module Gitlab
value = 0 value = 0
Gitlab::Redis::Cache.with do |redis| Gitlab::Redis::Cache.with do |redis|
cache_key = "action_rate_limiter:#{action.to_s}:#{key}" cache_key = "action_rate_limiter:#{action}:#{key}"
value = redis.incr(cache_key) value = redis.incr(cache_key)
redis.expire(cache_key, expiry_time) if value == 1 redis.expire(cache_key, expiry_time) if value == 1
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment