mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-26 12:01:08 +00:00
Add a transaction to pickTask (#33543)
In the old `pickTask`, when getting secrets or variables failed, the task could get stuck in the `running` status (task status is `running` but the runner did not fetch the task). To fix this issue, these steps should be in one transaction. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 06f10656369c7e4274ae4e9f9edb21e1cac520d9)
This commit is contained in:
parent
dccd443e04
commit
e932f89a13
3 changed files with 108 additions and 96 deletions
|
|
@ -158,7 +158,7 @@ func (s *Service) FetchTask(
|
|||
// if the task version in request is not equal to the version in db,
|
||||
// it means there may still be some tasks not be assigned.
|
||||
// try to pick a task for the runner that send the request.
|
||||
if t, ok, err := pickTask(ctx, runner); err != nil {
|
||||
if t, ok, err := actions_service.PickTask(ctx, runner); err != nil {
|
||||
log.Error("pick task failed: %v", err)
|
||||
return nil, status.Errorf(codes.Internal, "pick task: %v", err)
|
||||
} else if ok {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue