Skip to content

Commit 1a52277

Browse files
committed
fix comment and fixme
1 parent f8ad8c0 commit 1a52277

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

services/actions/run.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
actions_model "code.gitea.io/gitea/models/actions"
1111
"code.gitea.io/gitea/models/db"
12-
"code.gitea.io/gitea/modules/log"
1312
"code.gitea.io/gitea/modules/util"
1413
notify_service "code.gitea.io/gitea/services/notify"
1514

@@ -53,29 +52,27 @@ func PrepareRunAndInsert(ctx context.Context, content []byte, run *actions_model
5352
run.Title = jobs[0].RunName
5453
}
5554

56-
if err := InsertRun(ctx, run, jobs, vars); err != nil {
55+
if err = InsertRun(ctx, run, jobs, vars); err != nil {
5756
return fmt.Errorf("InsertRun: %w", err)
5857
}
5958

60-
// FIXME PERF do we need this db round trip?
59+
// Load the newly inserted jobs with all fields from database (the job models in InsertRun are partial, so load again)
6160
allJobs, err := db.Find[actions_model.ActionRunJob](ctx, actions_model.FindRunJobOptions{RunID: run.ID})
6261
if err != nil {
63-
log.Error("FindRunJobs: %v", err)
62+
return fmt.Errorf("FindRunJob: %w", err)
6463
}
6564

6665
// FIXME PERF skip this for schedule, dispatch etc.
67-
CreateCommitStatus(ctx, allJobs...)
68-
69-
err = run.LoadAttributes(ctx)
70-
if err != nil {
71-
log.Error("LoadAttributes: %v", err)
66+
const shouldCreateCommitStatus = true
67+
if shouldCreateCommitStatus {
68+
CreateCommitStatus(ctx, allJobs...)
7269
}
70+
7371
notify_service.WorkflowRunStatusUpdate(ctx, run.Repo, run.TriggerUser, run)
7472
for _, job := range allJobs {
7573
notify_service.WorkflowJobStatusUpdate(ctx, run.Repo, run.TriggerUser, job, nil)
7674
}
7775

78-
// Return nil if no errors occurred
7976
return nil
8077
}
8178

0 commit comments

Comments
 (0)