Enqueue sidekiq jobs dynamically
Sidekiq::Client.push('class' => 'WorkerClass', 'args' => [11, 5, 1993])
is equivalent to
WorkerClass.perform_async(11, 5, 1993)
Related cards:
Why Sidekiq Jobs should never be enqueued in an `after_create` or `after_save` callback
When an object is created / updated, various callbacks are executed in this order:
before_validation
after_validation
before_save
around_save
before_create
aro...
How to monitor Sidekiq: A working example
In order to have monitoring for Sidekiq (like queue sizes, last run of Sidekiq) your application should have a monitoring route which returns a json looking like this:
{
"sidekiq": {
"totals": {
"failed": 343938,
"proces...
Perform Sidekiq jobs immediately in development
# config/initializers/sidekiq.rb
# Perform Sidekiq jobs immediately in development,
# so you don't have to run a separate process.
# You'll also benefit from code reloading.
if Rails.env.development?
require 'sidekiq/testing'
Sidekiq::T...
makandra_sidekiq 0.2.0 respects the configured Sidekiq timeout
There was an issue with makandra_sidekiq < 0.2 concerning the stopping of Sidekiq.
Sidekiq < 6 has two finishing timeouts: one for finishing things itself (A), and one for sidekiqctl
befo...
How to implement simple queue limiting/throttling for Sidekiq
The sidekiq-rate-limiter gem allows rate-limiting Sidekiq jobs and works like a charm. However, it needs to be integrated on a per-worker basis.
If you want to limit a whole queue instead, and if y...
Heads up: Sidekiq per default silently fails when retries are exhausted!
For Sidekiq to be able to retry your jobs it has to be able to catch errors that occur while a job is executed.
Per default, Sidekiq will not raise / notify you if the retry count is exhausted. It will only copy the job to the dead queue (see...
Sidekiq 7: Rate limiting with capsules
Sidekiq 7 adds a new feature called capsules.
Use cases:
- a
chrome
queue limited to1
for e.g. PDF processing to not overload the applicati...
How to include Sidekiq job IDs in Rails logs
When logging in Rails, you can use the log_tags
configuration option to add extra information to each line, like :request_id
or :subdomain
. However, those ...
Getting Sidekiq error "delay is defined by Active Record"
Reason: You very likely have a model that has a delay
attribute.
You can configure Sidekiq to remove its delay
method by adding this to your Sidekiq initializer:
Sidekiq.remove_delay!
If you need to keep Sidekiqs delay
features, add `...