15
Postgres is All You Need for Durable Workflows
(www.dbos.dev)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
The article fails to actually explain how to do durable workflows in Postgres:
What you want are a locking clause (
FOR UPDATEfor example) to "acquire" an item from your queue andSKIP LOCKEDto skip over rows that are being processed. Contrary to what you'd normally do, you'd hold a long-running transaction which maintains a lock on the row you're processing, then on completion either commits (success) or rolls back (failure) its changes to that row.You also don't want to poll. Use
LISTENinstead.Don't forget
NOTIFYI think this is a decent explanation: https://www.mgaillard.fr/2024/12/01/job-queue-postgresql.html