Skip to content

Commit

Permalink
Honor existing deployed limits
Browse files Browse the repository at this point in the history
In a cluster with auto-scaling sidekiq servers, a new server entering
the pool runs Queues.start, which looks at the config file and sets
the limit and process_limit values accordingly.  However, if at
runtime these values have been changed dynamically for any reason,
this overwrites the values with what is in the config file, or removes
the limits if there are none in the config file.  This is unexpected
behavior.

Instead, at startup, honor the values found in redis if any are
present.  Only set the values if none are present in redis.
  • Loading branch information
matt-domsch-sp committed Feb 25, 2024
1 parent f01f15e commit d946dc3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/sidekiq/limit_fetch/queues.rb
Expand Up @@ -142,6 +142,8 @@ def apply_process_limit_to_queues

def apply_process_limit_to_queue(queue_name)
queue = Sidekiq::Queue[queue_name]
return unless queue.process_limit.nil? # honor existing deployed limits

queue.process_limit = @process_limits[queue_name.to_s] || @process_limits[queue_name.to_sym]
end

Expand All @@ -155,6 +157,7 @@ def apply_limit_to_queue(queue_name)
queue = Sidekiq::Queue[queue_name]

return if queue.limit_changed?
return unless queue.limit.nil? # honor existing deployed limits

queue.limit = @limits[queue_name.to_s] || @limits[queue_name.to_sym]
end
Expand Down

0 comments on commit d946dc3

Please sign in to comment.