Class: Sidekiq::RetrySet
Overview
Allows enumeration of retries within Sidekiq. Based on this, you can search/filter for jobs. Here’s an example where I’m selecting all jobs of a certain type and deleting them from the retry queue.
r = Sidekiq::RetrySet.new
r.select do |retri|
retri.klass == 'Sidekiq::Extensions::DelayedClass' &&
retri.args[0] == 'User' &&
retri.args[1] == 'setup_new_subscriber'
end.map(&:delete)
Instance Attribute Summary
Attributes inherited from SortedSet
Instance Method Summary collapse
-
#initialize ⇒ RetrySet
constructor
A new instance of RetrySet.
- #kill_all ⇒ Object
- #retry_all ⇒ Object
Methods inherited from JobSet
#delete_by_jid, #delete_by_value, #each, #fetch, #find_job, #schedule
Methods inherited from SortedSet
Constructor Details
#initialize ⇒ RetrySet
Returns a new instance of RetrySet.
693 694 695 |
# File 'lib/sidekiq/api.rb', line 693 def initialize super "retry" end |
Instance Method Details
#kill_all ⇒ Object
701 702 703 |
# File 'lib/sidekiq/api.rb', line 701 def kill_all each(&:kill) while size > 0 end |
#retry_all ⇒ Object
697 698 699 |
# File 'lib/sidekiq/api.rb', line 697 def retry_all each(&:retry) while size > 0 end |