lib/sidekiq/limit_fetch/global/monitor.rb in sidekiq-limit_fetch-2.2.7 vs lib/sidekiq/limit_fetch/global/monitor.rb in sidekiq-limit_fetch-2.3.0

- old
+ new

@@ -3,16 +3,17 @@ include Sidekiq::LimitFetch::Redis extend self HEARTBEAT_PREFIX = 'limit:heartbeat:' PROCESS_SET = 'limit:processes' - HEARTBEAT_TTL = 18 - REFRESH_TIMEOUT = 10 + HEARTBEAT_TTL = 20 + REFRESH_TIMEOUT = 5 - def start!(ttl=HEARTBEAT_TTL, timeout=REFRESH_TIMEOUT) + def start!(queues, ttl=HEARTBEAT_TTL, timeout=REFRESH_TIMEOUT) Thread.new do loop do + add_dynamic queues if queues.dynamic? update_heartbeat ttl invalidate_old_processes sleep timeout end end @@ -30,9 +31,13 @@ def remove_old_processes! redis do |it| old_processes.each {|process| it.srem PROCESS_SET, process } end + end + + def add_dynamic(queues) + queues.add Sidekiq::Queue.all.map(&:name) end private def update_heartbeat(ttl)