Skip to content

Clear attempts after snoozing #961

@albinofreitasdito

Description

@albinofreitasdito

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions