Skip to content

Commit 9967214

Browse files
committed
Ensure read lock when fetching next pending job
1 parent 0dd7ba7 commit 9967214

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

model/job.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ func FetchNextPending(db *sqlx.DB) (*Job, error) {
393393
join job_status s on s.id = j.status_id
394394
where j.status_id = ?
395395
order by j.submitted asc
396-
limit 1`, StatusPending)
396+
limit 1
397+
for update`, StatusPending)
397398
if err != nil {
398399
return nil, err
399400
}

0 commit comments

Comments
 (0)