Skip to content

Commit

Permalink
Preferentially spawn older tasks first
Browse files Browse the repository at this point in the history
This changes the new task spawning setup to preferentially resume older
tasks (as determined by task id) first.
  • Loading branch information
swlynch99 committed Oct 24, 2024
1 parent 3ef1ef9 commit 83ca79a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.

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

3 changes: 2 additions & 1 deletion crates/durable-runtime/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ impl Worker {
FROM durable.task
WHERE (state IN ('ready', 'active') AND running_on IS NULL)
OR (state = 'ready' AND running_on = $1)
FOR UPDATE SKIP LOCKED
ORDER BY id ASC
FOR NO KEY UPDATE SKIP LOCKED
LIMIT $2
)
UPDATE durable.task
Expand Down

0 comments on commit 83ca79a

Please sign in to comment.