Skip to content

Commit

Permalink
Order leased jobs by serial (#2912)
Browse files Browse the repository at this point in the history
This will ensure the job leased first, gets send to the cluster first

Currently we just order by postgres default sorting - which often picks the most recently leased - causing the first lease jobs to get stuck
 - This only occurs when scheduling is faster than leasing
  • Loading branch information
JamesMurkin authored Aug 24, 2023
1 parent 9ea0eef commit 9a66b4f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/scheduler/database/job_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func (r *PostgresJobRepository) FetchJobRunLeases(ctx context.Context, executor
AND jr.succeeded = false
AND jr.failed = false
AND jr.cancelled = false
ORDER BY jr.serial
LIMIT %d;
`

Expand Down

0 comments on commit 9a66b4f

Please sign in to comment.