Skip to content

Commit 380a9ed

Browse files
authored
fix(engine): context cancel in postTakeWorkflowJob / initWorkflowRun (#6637)
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
1 parent bf4b843 commit 380a9ed

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

engine/api/workflow_queue.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ func (api *API) postTakeWorkflowJobHandler() service.Handler {
117117
return err
118118
}
119119

120-
workflow.ResyncNodeRunsWithCommits(ctx, api.mustDB(), api.Cache, *p, report)
121-
go api.WorkflowSendEvent(context.Background(), *p, report)
120+
workflow.ResyncNodeRunsWithCommits(api.Router.Background, api.mustDBWithCtx(api.Router.Background), api.Cache, *p, report)
121+
api.GoRoutines.Exec(api.Router.Background, "workflow-send-event", func(ctx context.Context) {
122+
api.WorkflowSendEvent(ctx, *p, report)
123+
})
122124

123125
return service.WriteJSON(w, pbji, http.StatusOK)
124126
}

engine/api/workflow_run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ func (api *API) initWorkflowRun(ctx context.Context, projKey string, wf *sdk.Wor
11271127
report.Merge(ctx, r)
11281128
return report
11291129
}
1130-
workflow.ResyncNodeRunsWithCommits(ctx, api.mustDB(), api.Cache, *p, report)
1130+
workflow.ResyncNodeRunsWithCommits(api.Router.Background, api.mustDBWithCtx(api.Router.Background), api.Cache, *p, report)
11311131

11321132
api.initWorkflowRunPurge(ctx, wf)
11331133

0 commit comments

Comments
 (0)