Skip to content

Commit

Permalink
fix(api): fix load run error (#2883)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and sguiheux committed Jun 14, 2018
1 parent 429757a commit bdf1891
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions engine/api/workflow/execute_node_job_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,20 @@ func UpdateNodeJobRunStatus(ctx context.Context, dbCopy *gorp.DbMap, db gorp.Sql
var errReport error
report, errReport = report.Merge(execute(ctx, dbCopy, db, store, proj, node))

wr, err := LoadRunByID(db, node.WorkflowRunID, LoadRunOptions{DisableDetailledNodeRun: true})
if err != nil {
return report, sdk.WrapError(err, "workflow.UpdateNodeJobRunStatus> Cannot load run by ID %d", node.WorkflowRunID)
}

//Start a goroutine to update commit statuses in repositories manager
go func() {
wr, err := LoadRunByID(dbCopy, node.WorkflowRunID, LoadRunOptions{})
if err != nil {
log.Error("workflow.UpdateNodeJobRunStatus> Cannot load run by ID %d", node.WorkflowRunID)
return
}
if sdk.StatusIsTerminated(wr.Status) {
go func(wfRun *sdk.WorkflowRun) {
if sdk.StatusIsTerminated(wfRun.Status) {
wr.LastExecution = time.Now()
if err := ResyncCommitStatus(ctx, dbCopy, store, proj, wr); err != nil {
if err := ResyncCommitStatus(ctx, dbCopy, store, proj, wfRun); err != nil {
log.Error("workflow.UpdateNodeJobRunStatus> %v", err)
}
}
}()
}(wr)

return report, errReport
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/views/pipeline/show/pipeline.show.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class PipelineShowComponent implements OnInit, OnDestroy {

this.asCodeEditorSubscription = this._pipCoreService.getAsCodeEditor()
.subscribe((state) => {
if (state != null && !state.save && !state.open) {
if (state != null && !state.save && !state.open && this.pipeline) {
let pipName = this.pipeline.name;
this.pipeline = null;
this.refreshDatas(this.project.key, pipName);
Expand Down

0 comments on commit bdf1891

Please sign in to comment.