From 1646491e1fd21ec886e029c2d9d6c939afe4af4c Mon Sep 17 00:00:00 2001 From: Matthew Kent Date: Thu, 25 Sep 2025 15:40:16 -0700 Subject: [PATCH] Support the new dynamic interval sleep. While also maintaining backwards compatibility. See https://github.com/resque/resque/pull/1920. --- lib/resque/pool.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/resque/pool.rb b/lib/resque/pool.rb index 97ce75ce..73629c54 100644 --- a/lib/resque/pool.rb +++ b/lib/resque/pool.rb @@ -432,7 +432,15 @@ def spawn_worker!(queues) call_after_prefork!(worker) reset_sig_handlers! #self_pipe.each {|io| io.close } - worker.work(ENV['INTERVAL'] || DEFAULT_WORKER_INTERVAL) # interval, will block + # will block until a shutdown signal is received + if worker.method(:work).parameters.size > 2 # Backwards compat + worker.work(ENV["INTERVAL"], + max_interval: ENV['MAX_INTERVAL'], + min_interval: ENV['MIN_INTERVAL'], + backoff_interval: ENV['BACKOFF_INTERVAL']) + else + worker.work(ENV['INTERVAL'] || DEFAULT_WORKER_INTERVAL) + end end workers[queues][pid] = worker call_after_spawn!(worker, pid, workers)