SidekiqRejector
The simple way for rejecting jobs when code introduced with unwanted behavior(bug) and there is a must to stop handling this type of jobs until a fix is issued.
Requirements
Only sidekiq 3 is supported.
Installation
Add this line to your application's Gemfile:
gem 'sidekiq_rejector'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sidekiq_rejector
Usage
All that you need in case you want to exclude jobs is to configure two environment variables
SIDEKIQ_REJECTOR_ENABLED = true
From version 2.0 the SIDEKIQ_REJECTOR_VALUES would be a json object with three string arrays:
{
queue: [...], # name of queues
worker: [...], # worker classes
method: [...] # method names
}.to_json
Version 0.1.x users should use the old format: SIDEKIQ_REJECTOR_VALUES = 'comma separated string' with values of the method to stop (when called using delay) OR the worker name.
There is also a utility class that will remove jobs directly from Redis. This is for a situation were a huge amount of jobs already queued and they may clog the background workers.
Inputs: queue_name - The target queue that you want to clear
string_identifier - The method name OR worker name, using this identifier the jobs are found.
SidekiqRejector::JobRemover.remove(queue_name, string_identifier)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request