Skip to content

Commit

Permalink
ensure job cancellation selection holds a lock (#67)
Browse files Browse the repository at this point in the history
Since we select and then update a set of tasks in a transaction in order
to cancel pending tasks relative to a given job, we should also hold a
lock over that selection via `for update`.
  • Loading branch information
maxcountryman authored Nov 17, 2024
1 parent e045d18 commit a3febe0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ impl<T: Task> EnqueuedJob<T> {
from underway.task
where input->>'job_id' = $1
and state = $2
for update skip locked
"#,
self.id.to_string(),
TaskState::Pending as TaskState
Expand Down

0 comments on commit a3febe0

Please sign in to comment.