Expand description
The worker loop: reserve, run, and then delete, retry, or bury.
What queue:work runs. A worker is deliberately dull — it owns no state
beyond its options, so N of them against one queue is the same code run N
times, and a worker that dies mid-job leaves the job recoverable rather than
lost.
Structs§
- Shutdown
- A shutdown signal shared by every worker in a pool.
- Worker
- One worker. Cloning is cheap and gives a second worker on the same queue.
- Worker
Options - How a worker behaves.
- Worker
Stats - A tally of what a worker did, returned when it stops.
Enums§
- Outcome
- What happened to one job.
Constants§
- DEFAULT_
BACKOFF_ CAP - The ceiling on exponential backoff. Without one, a job on its fifteenth attempt would be scheduled a year out and never seen again.
- DEFAULT_
POLL_ INTERVAL - How long a worker waits before asking an empty queue again.
Functions§
- backoff
- How long to wait before the next attempt.
- outcome_
to_ json - A convenience for a dashboard: the worker events as JSON.
- run_
pool - Run
countcopies of a worker concurrently, all watching one shutdown signal, and return their combined tally once every one has stopped.