Skip to content

Commit

Permalink
Fix incorrect run order of action jobs (go-gitea#28367)
Browse files Browse the repository at this point in the history
When we pick up a job, all waiting jobs should firstly be ordered by
update time,
otherwise when there's a running job, if I rerun an older job, the older
job will run first, as it's id is smaller.
  • Loading branch information
yp05327 authored and fuxiaohei committed Jan 17, 2024
1 parent 0c2b767 commit 09d42c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/actions/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
}

var jobs []*ActionRunJob
if err := e.Where("task_id=? AND status=?", 0, StatusWaiting).And(jobCond).Asc("id").Find(&jobs); err != nil {
if err := e.Where("task_id=? AND status=?", 0, StatusWaiting).And(jobCond).Asc("updated", "id").Find(&jobs); err != nil {
return nil, false, err
}

Expand Down

0 comments on commit 09d42c0

Please sign in to comment.