You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/11/20 13:03:47 UTC

(incubator-devlake) branch release-v0.20 updated: fix(pipeline): fix potiential panic (#6486)

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

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


The following commit(s) were added to refs/heads/release-v0.20 by this push:
     new 560e414a3 fix(pipeline): fix potiential panic (#6486)
560e414a3 is described below

commit 560e414a37216ead5ed9918d51c0b82e26c3d1ae
Author: Lynwee <li...@merico.dev>
AuthorDate: Mon Nov 20 21:03:41 2023 +0800

    fix(pipeline): fix potiential panic (#6486)
---
 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
 }