"On job failure" hook #969
-
|
Hi, thanks for all your work on this. I was wondering if you have any recommendations for how to properly hook into job failures to execute cleanup or similar. For example, if I have jobs that progress through a state machine, I might want to set some record to "FAILED" if the job fails all of it's retries (send to a DLQ, increment some counters so we could alert, etc). I see there the ability to set a customer error handler for a client. Is the thought one would have a distinct client and error handler per queue that they might need to differentiate (or a catch all error handler that differentiates by queue etc). Is there a way to distinguish between job failures that will be retried and those that have hit their limit? The other option I was considering was some sort of polling of failed jobs but I wasn't sure if there was a better way, or if there is a better pattern for this in general |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
I'm sorry right after I submit this I realize I only searched "retry" and "failure", and completely forgot to check for the word "hooks", which is exactly what I was asking about. If anyone stumbles on this: https://pkg.go.dev/github.com/riverqueue/river/rivertype#HookWorkEnd |
Beta Was this translation helpful? Give feedback.
I'm sorry right after I submit this I realize I only searched "retry" and "failure", and completely forgot to check for the word "hooks", which is exactly what I was asking about.
If anyone stumbles on this: https://pkg.go.dev/github.com/riverqueue/river/rivertype#HookWorkEnd