Class: Sidekiq::RetrySet

Inherits:
SortedSet show all
Defined in:
lib/sidekiq/api.rb

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 Method Summary collapse

Methods inherited from SortedSet

#clear, #delete, #each, #fetch, #find_job, #schedule, #size

Constructor Details

#initializeRetrySet

Returns a new instance of RetrySet.



364
365
366
# File 'lib/sidekiq/api.rb', line 364

def initialize
  super 'retry'
end

Instance Method Details

#retry_allObject



368
369
370
371
372
# File 'lib/sidekiq/api.rb', line 368

def retry_all
  while size > 0
    each(&:retry)
  end
end