diff options
author | Jason Song <i@wolfogre.com> | 2023-05-10 19:54:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 13:54:18 +0200 |
commit | 2d0ff00823bf92ee32df107416fd30010638f21d (patch) | |
tree | a7cc8e322cc1f4be970150fd910298d4609f2d34 /routers/api/actions | |
parent | ea7954f069bf8bcb87d520f8aab0a80b0768590d (diff) | |
download | gitea-2d0ff00823bf92ee32df107416fd30010638f21d.tar.gz gitea-2d0ff00823bf92ee32df107416fd30010638f21d.zip |
Improve updating Actions tasks (#24600)
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'routers/api/actions')
-rw-r--r-- | routers/api/actions/runner/runner.go | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/routers/api/actions/runner/runner.go b/routers/api/actions/runner/runner.go index 73c6b746a0..895b281725 100644 --- a/routers/api/actions/runner/runner.go +++ b/routers/api/actions/runner/runner.go @@ -10,7 +10,6 @@ import ( actions_model "code.gitea.io/gitea/models/actions" "code.gitea.io/gitea/modules/actions" - "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/util" actions_service "code.gitea.io/gitea/services/actions" @@ -120,27 +119,7 @@ func (s *Service) UpdateTask( ctx context.Context, req *connect.Request[runnerv1.UpdateTaskRequest], ) (*connect.Response[runnerv1.UpdateTaskResponse], error) { - { - // to debug strange runner behaviors, it could be removed if all problems have been solved. - stateMsg, _ := json.Marshal(req.Msg.State) - log.Trace("update task with state: %s", stateMsg) - } - - // Get Task first - task, err := actions_model.GetTaskByID(ctx, req.Msg.State.Id) - if err != nil { - return nil, status.Errorf(codes.Internal, "can't find the task: %v", err) - } - if task.Status.IsCancelled() { - return connect.NewResponse(&runnerv1.UpdateTaskResponse{ - State: &runnerv1.TaskState{ - Id: req.Msg.State.Id, - Result: task.Status.AsResult(), - }, - }), nil - } - - task, err = actions_model.UpdateTaskByState(ctx, req.Msg.State) + task, err := actions_model.UpdateTaskByState(ctx, req.Msg.State) if err != nil { return nil, status.Errorf(codes.Internal, "update task: %v", err) } |