I have jobs does it take more than 2h to finish. I want to put a time to limit how long it will take it. How do i can do?
Wrap the logic with Timeout::timeout
and disable retries if you don't want the job to be retried after a timeout.
class RunsTooLongWorker
include Sidekiq::Worker
sidekiq_options :retry => false
def perform(*args)
Timeout::timeout(2.hours) do
# do possibly long running task
end
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With