aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-12-07 07:10:05 +0900
committerGitHub <noreply@github.com>2023-12-06 22:10:05 +0000
commitf4561c44b1cad700bf41537eb4db487fff34f6c9 (patch)
treeea2fb40347c364b4e50291d12042646177d9a19e /models
parent22cb5b0c17d578bc995a7c99ca96711886a1fd5d (diff)
downloadgitea-f4561c44b1cad700bf41537eb4db487fff34f6c9.tar.gz
gitea-f4561c44b1cad700bf41537eb4db487fff34f6c9.zip
Fix incorrect run order of action jobs (#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.
Diffstat (limited to 'models')
-rw-r--r--models/actions/task.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/actions/task.go b/models/actions/task.go
index db0031b3b8..96a6d2e80c 100644
--- a/models/actions/task.go
+++ b/models/actions/task.go
@@ -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
}