Skip to content

Commit 59d4108

Browse files
yp05327silverwind
authored andcommitted
Fix incorrect run order of action jobs (go-gitea#28367)
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.
1 parent 444e115 commit 59d4108

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/actions/task.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
234234
}
235235

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

0 commit comments

Comments
 (0)