mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-26 23:56:37 +09:00
3875db1974
Adds a read-only Actions job queue: running jobs first, then waiting jobs in the order a runner picks them up. It is shown instance-wide in the admin Actions section with owner, repository and status filters, and per repository in the Actions tab. Both lists refresh in place. Pending work is currently only visible per repository and newest-first, so nothing shows what is queued, in which order, or what occupies the runners. Reordering the queue will be proposed separately. A migration adds indexes for the runner pickup query and repository-scoped status lookups. * Fix #34198 <img width="1345" height="451" alt="image" src="https://github.com/user-attachments/assets/7d52ff76-81b4-44e8-b583-d7d89c9dffcd" /> <img width="1809" height="1134" alt="image" src="https://github.com/user-attachments/assets/4d56c0cb-bae7-4ce2-8f3c-75163b2bc7f4" /> --------- Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
35 lines
914 B
Go
35 lines
914 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v28
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.dev/modelmigration/base"
|
|
"gitea.dev/modules/timeutil"
|
|
|
|
"xorm.io/xorm"
|
|
)
|
|
|
|
// AddActionQueueIndexes indexes the runner pickup query and repository-scoped status lookups.
|
|
func AddActionQueueIndexes(_ context.Context, x base.EngineMigration) error {
|
|
type ActionRunJob struct {
|
|
RepoID int64 `xorm:"index(repo_status)"`
|
|
TaskID int64 `xorm:"index(pickup)"`
|
|
Status int `xorm:"index(pickup) index(repo_status)"`
|
|
Updated timeutil.TimeStamp `xorm:"index(pickup)"`
|
|
}
|
|
|
|
type ActionRun struct {
|
|
RepoID int64 `xorm:"index(repo_status)"`
|
|
Status int `xorm:"index(repo_status)"`
|
|
}
|
|
|
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
|
IgnoreDropIndices: true,
|
|
IgnoreConstrains: true,
|
|
}, new(ActionRunJob), new(ActionRun))
|
|
return err
|
|
}
|