diff --git a/internal/scheduler/database/job_repository.go b/internal/scheduler/database/job_repository.go index 3592da8d3c0..4590a35f33a 100644 --- a/internal/scheduler/database/job_repository.go +++ b/internal/scheduler/database/job_repository.go @@ -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; `