Last active
January 7, 2016 08:49
-
-
Save andreaseriksson/41f16f832dd6ec34d168 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sidekiq/api' | |
# get a handle to the default queue | |
default_queue = Sidekiq::Queue.new | |
# clear the queue | |
Sidekiq::Queue.new.clear | |
# get a handle to the mailer queue | |
mailer_queue = Sidekiq::Queue.new("mailer") | |
# How many jobs are in the default queue? | |
default_queue.size # => 1001 | |
# How many jobs are in the mailer queue? | |
mailer_queue.size # => 50 | |
#Deletes all Jobs in a Queue, by removing the queue. | |
default_queue.clear | |
stats = Sidekiq::Stats.new | |
# Get the number of jobs that have been processed. | |
stats.processed # => 100 | |
# Get the number of jobs that have failed. | |
stats.failed # => 3 | |
# Get the queues with name and number enqueued. | |
stats.queues # => { "default" => 1001, "email" => 50 } | |
#Gets the number of jobs enqueued in all queues (does NOT include retries and scheduled jobs). | |
stats.enqueued # => 1051 | |
rs = Sidekiq::RetrySet.new | |
rs.size | |
rs.clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment