Clear attempts after snoozing #967
Replies: 1 comment 1 reply
-
Hey @albinofreitasdito, hmm, this seems to be a little contrary to how completed/scheduled jobs currently work with River if I'm understanding correctly. When a job completes (even if it failed once), it's done. It doesn't go back to becoming available and/or scheduled again at some point in the future. So whatever its attempts has been incremented to by that point doesn't really matter anymore. It'll get a state of If you're using something like periodic jobs to repeat a job's schedule, each time the period fires a new job is inserted. So although part of the same series of jobs as its prior manifestations, it's a distinct job with its own retry schedule and number of attempts. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m running River v0.23.1 and I have several jobs which I occasionally need to “snooze.” However, if a job fails once and then succeeds on a later retry, River will still count that first failure against the job’s configured retry limit. Over time, successful retries reduce the remaining attempts, which I’d prefer not to happen - after a success, I want the job retry counter to reset so that it always starts with the full allotment of attempts on its next scheduled run.
My question is: would it be safe to implement this behavior by directly updating the job record in the database - specifically clearing or resetting the attempts (or increasing the max_attempts) field - immediately after a successful run? Are there any hidden consequences or invariants I might be violating by doing so?
Desired behavior
Job fails → River increments the attempt counter.
Job eventually succeeds → attempt counter is reset to zero (or back to its configured default).
Next scheduled run starts with a fresh set of retries.
Questions
Is there an option to do that directly through the worker without needing to update the job manually?
If not, is it safe to patch the database directly?
Any guidance or best practices would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions