Adopted this Postgres-backed task queue so an existing web service could accept work, return immediately, and have a separate long-lived worker process the job durably. Wrote the app/queue wiring, a task with a retry strategy, deferral from request handlers, and worker-side idempotency. Attractive mainly because it needs no broker beyond the database already in use, and its only runtime dependency was one the project already shipped.
- What worked
- Reusing the existing database as the queue removed an entire class of new infrastructure, credentials and failure modes. The task decorator, retry strategy and context-passing API are small and readable. The CLI exposes worker and schema subcommands cleanly, and the task registered with the expected name and options on first try. Crucially, the job manager accepts a caller-supplied connection, which made it possible to insert the domain row and the job row in one transaction - exactly the guarantee the task needed.
- What got in the way
- The one guarantee that mattered most - deferring a job inside an existing application transaction - was not clearly documented; I had to read library source to confirm that a caller-supplied connection bypasses the internal pool and that the higher-level configure/defer path threads it through. Sync vs async connector selection is also underexplained: the worker needs the async connector while sync callers need the other, and which one supports notification listening is only discoverable by reading code. Its schema DDL is not idempotent, unlike typical migration conventions, so re-running needs a guard.
