Programmatically finding the size of the retry queue with Sidekiq

How to use Sidekiq's API for querying the state of queues

There is an API that Sidekiq provides for programmatically querying the state of the various queues under Sidekiq’s control.

If you don’t want to expose the web interface to the world then using this API is a must.

Here is some sample code for finding how many items are currently in the retry queue, if you have too many jobs constantly failing there is likely something you need to change in your worker.

retry_queue = Sidekiq::RetrySet.new
retry_queue.size

I would encourage you to read more about the API.

Recent posts View all

Web DevProductivity

Keeping on top of website updates

Learn what website updates are, what they entail, why they are important, and how we can help

Freelancing

Getting the most out of your agency

Here are some tips based on years of working with, for, and as an agency on how to get the most out of any work you do.