lib/sidekiq/limit_fetch/global/monitor.rb in sidekiq-limit_fetch-4.3.2 vs lib/sidekiq/limit_fetch/global/monitor.rb in sidekiq-limit_fetch-4.4.0
- old
+ new
@@ -25,11 +25,11 @@
Sidekiq.redis {|it| it.smembers PROCESS_SET }
end
def old_processes
all_processes.reject do |process|
- Sidekiq.redis {|it| it.get heartbeat_key process }
+ Sidekiq.redis {|it| it.get heartbeat_key process } == '1'
end
end
def remove_old_processes!
Sidekiq.redis do |it|
@@ -37,18 +37,23 @@
end
end
def handle_dynamic_queues
queues = Sidekiq::LimitFetch::Queues
- queues.handle Sidekiq::Queue.all.map(&:name) if queues.dynamic?
+ return unless queues.dynamic?
+
+ available_queues = Sidekiq::Queue.all.map(&:name).reject do |it|
+ queues.dynamic_exclude.include? it
+ end
+ queues.handle available_queues
end
private
def update_heartbeat(ttl)
Sidekiq.redis do |it|
it.multi do |pipeline|
- pipeline.set heartbeat_key, true
+ pipeline.set heartbeat_key, '1'
pipeline.sadd PROCESS_SET, [Selector.uuid]
pipeline.expire heartbeat_key, ttl
end
end
end