问题
I'm using sidekiq pro for my application, and it's been working great. But I'd like to have a way to notify my users that a failed job is being retried.
A flow would go something like this:
Batch starts
worker1 runs successfully
worker2 runs successfully
worker3 fails
oncomplete fires, stuff happens
worker3 restarts
** onretry fires, notification sent to user
worker 3 runs successfully
onsuccess fires, stuff happens
My imaginary onretry doesn't exist in the documentation but I'm hoping there's a way to fake it. I know that I can tell if the batch has failures via the status object, but I don't see a way to get a retry event. Is there such a thing?
回答1:
The most workable approach is likely a server-side middleware which can detect a retry in progress for a batched job and send an email.
来源:https://stackoverflow.com/questions/37710594/sidekiq-pro-callback-when-batch-is-retried