8 ms·
That's a good approach if the worker is connected to the database. If an external process is responsible for marking a job as done, you could add a timestamp c
by throwaway74567 3y ago
That's a good approach if the worker is connected to the database.
If an external process is responsible for marking a job as done, you could add a timestamp column that will act as a timeout. The column will be updated before the job is given to the worker.
SELECT ... WHERE ts > NOW()
UPDATE ... SET ts = NOW() + INTERVAL '1 HOUR'