This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 3adb9d254 fix(pipeline): fix potiential panic (#6484)
3adb9d254 is described below

commit 3adb9d2549f4c0d2d885f833d3832b295cba269d
Author: Lynwee <[email protected]>
AuthorDate: Mon Nov 20 19:43:25 2023 +0800

    fix(pipeline): fix potiential panic (#6484)
---
 backend/core/runner/run_pipeline.go | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/backend/core/runner/run_pipeline.go 
b/backend/core/runner/run_pipeline.go
index 20816de7e..24a07453b 100644
--- a/backend/core/runner/run_pipeline.go
+++ b/backend/core/runner/run_pipeline.go
@@ -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 {
@@ -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
 }

Reply via email to