Skip to content

Commit 3943f68

Browse files
committed
fix: Ensure only 1 job is claimed for PostgreSQL
1 parent 3cd63a2 commit 3943f68

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Classes/Domain/PostgreSQLScheduler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class PostgreSQLScheduler extends AbstractScheduler {
2020
AND claimed = ''
2121
AND running = 0
2222
ORDER BY duedate ASC
23+
LIMIT 1
24+
FOR UPDATE SKIP LOCKED
2325
) AS delinquents
2426
WHERE j.identifier = delinquents.identifier
2527
AND j.claimed = '';
@@ -43,6 +45,8 @@ class PostgreSQLScheduler extends AbstractScheduler {
4345
SET running = 1,
4446
activity = NOW()
4547
WHERE claimed = :claimed
48+
AND groupname = :groupname
49+
AND running = 2
4650
PostgreSQL;
4751

4852

0 commit comments

Comments
 (0)