Skip to content

Commit

Permalink
fix(pipeline): fix potiential panic (apache#6484)
Browse files Browse the repository at this point in the history
  • Loading branch information
d4x1 committed Nov 20, 2023
1 parent 1e9acdf commit 3adb9d2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion backend/core/runner/run_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ func runPipelineTasks(
return err
}

// if pipeline has been cancelled, just return.
if dbPipeline.Status == models.TASK_CANCELLED {
return nil
}

// This double for loop executes each set of tasks sequentially while
// executing the set of tasks concurrently.
for i, row := range taskIds {
Expand All @@ -90,6 +95,10 @@ func runPipelineTasks(
}
}
}
log.Info("pipeline finished in %d ms: %v", time.Now().UnixMilli()-dbPipeline.BeganAt.UnixMilli(), err)
if dbPipeline.BeganAt != nil {
log.Info("pipeline finished in %d ms: %v", time.Now().UnixMilli()-dbPipeline.BeganAt.UnixMilli(), err)
} else {
log.Info("pipeline finished at %d ms: %v", time.Now().UnixMilli(), err)
}
return err
}

0 comments on commit 3adb9d2

Please sign in to comment.