Reputation: 48450
I have jobs of a particular type that I'd like to have retry more frequently than set by the default Sidekiq interval. Is this currently possible? Ideally the job would retry every 5 seconds for up to a minute. Not entirely sure this is currently something that's trivial to plugin to a Sidekiq job.
Upvotes: 22
Views: 18465
Reputation: 51
I'm answering if calling 10.minutes
in the block works, because I can't comment on an answer.
According to the Sidekiq code, you need to pass an Integer, or either :kill
or :discard
symbols.
10.minutes
returns an instance of ActiveSupport::Duration
This means that the following would work:
class Worker
include Sidekiq::Worker
sidekiq_retry_in { 10.minutes.to_i }
end
Upvotes: 2
Reputation: 21
If you need other range, can use minute syntax
sidekiq_retry_in do |_count|
10.minutes
end
Upvotes: 1
Reputation: 2656
According to: https://github.com/mperham/sidekiq/wiki/Error-Handling you can do this:
class Worker
include Sidekiq::Worker
sidekiq_retry_in do |count|
5
end
end
Upvotes: 34