Skip to content

Commit df8e638

Browse files
fsaminyesnault
authored andcommitted
fix(api): use the root context for sending commit status (#2985)
this will avoid following logs: `resyncCommitStatus> Error sending status: sendVCSEventStatus> Unable to reload noderun xxxx: workflow.LoadNodeRunByID> Unable to load workflow_node_run node=xxxxx: context canceled `
1 parent 125b85b commit df8e638

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

engine/api/workflow/execute_node_job_run.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ func (r *ProcessorReport) Errors() []error {
9696

9797
// UpdateNodeJobRunStatus Update status of an workflow_node_run_job
9898
func UpdateNodeJobRunStatus(ctx context.Context, dbCopy *gorp.DbMap, db gorp.SqlExecutor, store cache.Store, proj *sdk.Project, job *sdk.WorkflowNodeJobRun, status sdk.Status) (*ProcessorReport, error) {
99-
var end func()
100-
ctx, end = tracing.Span(ctx, "workflow.UpdateNodeJobRunStatus",
99+
cctx, end := tracing.Span(ctx, "workflow.UpdateNodeJobRunStatus",
101100
tracing.Tag("workflow_node_run_job", job.ID),
102101
tracing.Tag("workflow_node_run_job_status", status),
103102
)
@@ -160,7 +159,7 @@ func UpdateNodeJobRunStatus(ctx context.Context, dbCopy *gorp.DbMap, db gorp.Sql
160159
}
161160
}
162161

163-
if err := UpdateNodeJobRun(ctx, db, store, job); err != nil {
162+
if err := UpdateNodeJobRun(cctx, db, store, job); err != nil {
164163
return nil, sdk.WrapError(err, "workflow.UpdateNodeJobRunStatus> Cannot update WorkflowNodeJobRun %d", job.ID)
165164
}
166165

@@ -172,11 +171,11 @@ func UpdateNodeJobRunStatus(ctx context.Context, dbCopy *gorp.DbMap, db gorp.Sql
172171
if errNR != nil {
173172
return nil, sdk.WrapError(errNR, "workflow.UpdateNodeJobRunStatus> Cannot LoadNodeRunByID node run %d", node.ID)
174173
}
175-
return report.Merge(syncTakeJobInNodeRun(ctx, db, nodeRun, job, stageIndex))
174+
return report.Merge(syncTakeJobInNodeRun(cctx, db, nodeRun, job, stageIndex))
176175
}
177176

178177
var errReport error
179-
report, errReport = report.Merge(execute(ctx, dbCopy, db, store, proj, node))
178+
report, errReport = report.Merge(execute(cctx, dbCopy, db, store, proj, node))
180179

181180
wr, err := LoadRunByID(db, node.WorkflowRunID, LoadRunOptions{DisableDetailledNodeRun: true})
182181
if err != nil {

0 commit comments

Comments
 (0)