database-queues
Installation
SKILL.md
Queues in the database
Part 1: SKIP LOCKED job queues
A naive jobs table fails with a second worker: workers lock the same oldest row and serialize, or all claim the same job.
FOR UPDATE SKIP LOCKED (Postgres 9.5+, MySQL 8+) fixes it by skipping rows already locked by another transaction rather than waiting.
BEGIN;