Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sidekiq: change rate of retry for failed job?

I have jobs of a particular type that I'd like to have retry more frequently than set by the default Sidekiq interval. Is this currently possible? Ideally the job would retry every 5 seconds for up to a minute. Not entirely sure this is currently something that's trivial to plugin to a Sidekiq job.

like image 809
randombits Avatar asked Dec 26 '13 17:12

randombits


People also ask

How Sidekiq works or how would you implement Sidekiq?

Sidekiq is an open-source framework that provides efficient background processing for Ruby applications. It uses Redis as an in-memory data structure to store all of its job and operational data. It's important to be aware that Sidekiq by default doesn't do scheduling, it only executes jobs.

What is Sidekiq concurrency?

Sidekiq handles concurrency by using multiple threads in its process. This way, it can process multiple jobs at once, each thread processing one job at a time. By default, Sidekiq uses 10 threads per process. You can configure it to use more threads, thus increasing concurrency.

Should I use Activejob Sidekiq?

If you build a web application you should minimize the amount of time spent responding to every user; a fast website means a happy user.

Is Sidekiq multithreaded?

At the same time, Sidekiq uses multithreading so it is much more memory-efficient than Rescue.


1 Answers

According to: https://github.com/mperham/sidekiq/wiki/Error-Handling you can do this:

class Worker
  include Sidekiq::Worker

  sidekiq_retry_in do |count|
    5
  end
end
like image 180
Bart Avatar answered Sep 19 '22 09:09

Bart