mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-16 20:00:03 +02:00
Reduce unnecessary DB queries for Actions tasks (#25199)
Close #24544 Changes: - Create `action_tasks_version` table to store the latest version of each scope (global, org and repo). - When a job with the status of `waiting` is created, the tasks version of the scopes it belongs to will increase. - When the status of a job already in the database is updated to `waiting`, the tasks version of the scopes it belongs to will increase. - On Gitea side, in `FeatchTask()`, will try to query the `action_tasks_version` record of the scope of the runner that call `FetchTask()`. If the record does not exist, will insert a row. Then, Gitea will compare the version passed from runner to Gitea with the version in database, if inconsistent, try pick task. Gitea always returns the latest version from database to the runner. Related: - Protocol: https://gitea.com/gitea/actions-proto-def/pulls/10 - Runner: https://gitea.com/gitea/act_runner/pulls/219
This commit is contained in:
parent
674df05b16
commit
f5c7d4cfdd
7 changed files with 174 additions and 9 deletions
|
@ -515,6 +515,8 @@ var migrations = []Migration{
|
|||
NewMigration("Alter Actions Artifact table", v1_21.AlterActionArtifactTable),
|
||||
// v266 -> v267
|
||||
NewMigration("Reduce commit status", v1_21.ReduceCommitStatus),
|
||||
// v267 -> v268
|
||||
NewMigration("Add action_tasks_version table", v1_21.CreateActionTasksVersionTable),
|
||||
}
|
||||
|
||||
// GetCurrentDBVersion returns the current db version
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue