Yossi Shasho
Yossi Shasho

Reputation: 3640

Rails 5 + ActiveJob + Sidekiq: Stop and log error after 10 retries

Trying to program a job that after 10 retries (from all exception types) will report a failure and die. Can't get it to work. Tried this answer and this one too. Neither worked. The best solution would be to access retry_count from within the perform method.

Upvotes: 2

Views: 2106

Answers (1)

Siim Liiser
Siim Liiser

Reputation: 4358

I think what you're asking for is the sidekiq_retries_exhausted hook. It will be called once your retries are up and job will move to dead queue. Just set retries to 10 and implement that hook.

config.death_handlers might also be interesting.

See docs here: https://github.com/mperham/sidekiq/wiki/Error-Handling#configuration

Upvotes: 1

Related Questions