Retries¶
Every job has a max_attempts (default 20). When a handler raises, Roost:
Records the exception (type, message, traceback) into the
errorsJSON column.If
attempt < max_attempts, marks the jobretryableand schedules it for a futurescheduled_atbased on the configured backoff strategy.Otherwise marks the job
discarded.
Backoff strategies¶
from roost import exponential, linear, fixed
worker = roost.worker(retry_strategy=exponential(base=2, jitter=True))
worker = roost.worker(retry_strategy=linear(step=30.0))
worker = roost.worker(retry_strategy=fixed(60.0))
The default is exponential(base=2, jitter=True) — ~2, 4, 8, 16, … seconds, capped at one day.
Snoozing¶
Inside a handler you can raise roost.SnoozeJob(seconds=…) to push the job back into available after seconds, without counting the run as a failure or incrementing the attempt counter. Useful when an external dependency tells you to retry later.