debian-forge-composer/pkg/jobqueue
Gianluca Zuccarelli 5a4d22cc6d pkg/dbjobqueue: fix enqueue/dequeue race condition
Currently there is a race condition that occurs between the
dbjobqueue enqueue and dequeue functions. Both queries make
use of the postgres `now()` timestamp function which returns
the timestamp of when the transaction started and not when
the statement is executed. The result of this is a timestamp
for a job's `started_at` field to be earlier than its
`queued_at` field causing a constraint violation.

Since the dequeue query will never be executed before the
enqueue query, changing the postgres timestamp function to
`statement_timestamp()` resolves this issue.
2022-09-14 12:44:46 +02:00
..
dbjobqueue pkg/dbjobqueue: fix enqueue/dequeue race condition 2022-09-14 12:44:46 +02:00
jobqueue.go Introduce logging adapter for jobqueue 2022-09-09 16:27:38 +02:00