breamware/sidekiq-batch

Add support for on_death callback

Closed this issue · 2 comments

Sidekiq Pro has a death callback:

Sidekiq can notify you when a Batch is complete or successful with batch.on(event, klass, options={}):

  1. complete - when all jobs in the batch have run once, successful or not.
  2. success - when all jobs in the batch have completed successfully.
  3. death - the first time a batch job dies

Regarding success, if a job fails continually it's possible the success event will never fire. If a job fails all retries and dies, it will fire any :death callbacks. The :death callback is always fired for first job in the batch that fails and does not retry. Even if you configure jobs to disable retries or job death, it will still fire the :death callback.

:death and :success are not mutually exclusive but the death callback firing means that the batch will not fire success without manual intervention. If you deploy a fix and manually re-enqueue a dead batch job, the batch can still fire :success.

But sidekiq-batch (lib/sidekiq/batch/callback.rb:8) silently fails if :death is passed.

Stale issue message

Can this be reopened? I think it is a valid feature given that sidekiq-batch purports to match the API of Sidekiq Pro.