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

zhangliang2022 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 d766b7565 feat: add error message when checking pipeline on 
startup(#4615) (#4649)
d766b7565 is described below

commit d766b7565f9f5b17b104a1dff2c1ce17d12f35fd
Author: d4x1 <[email protected]>
AuthorDate: Tue Mar 14 15:23:51 2023 +0800

    feat: add error message when checking pipeline on startup(#4615) (#4649)
    
    Co-authored-by: Lynwee Hou <[email protected]>
---
 backend/server/services/pipeline.go | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/backend/server/services/pipeline.go 
b/backend/server/services/pipeline.go
index 93ce40145..73c3dbd0b 100644
--- a/backend/server/services/pipeline.go
+++ b/backend/server/services/pipeline.go
@@ -20,6 +20,12 @@ package services
 import (
        "context"
        "fmt"
+       "os"
+       "path/filepath"
+       "strings"
+       "sync"
+       "time"
+
        "github.com/apache/incubator-devlake/core/dal"
        "github.com/apache/incubator-devlake/core/errors"
        "github.com/apache/incubator-devlake/core/models"
@@ -31,11 +37,6 @@ import (
        "go.temporal.io/sdk/client"
        "go.temporal.io/sdk/converter"
        "golang.org/x/sync/semaphore"
-       "os"
-       "path/filepath"
-       "strings"
-       "sync"
-       "time"
 )
 
 var notificationService *NotificationService
@@ -73,17 +74,24 @@ func pipelineServiceInit() {
                watchTemporalPipelines()
        } else {
                // standalone mode: reset pipeline status
-               err := db.UpdateColumn(
+               errMsg := "The process was terminated unexpectedly"
+               err := db.UpdateColumns(
                        &models.Pipeline{},
-                       "status", models.TASK_FAILED,
+                       []dal.DalSet{
+                               {ColumnName: "status", Value: 
models.TASK_FAILED},
+                               {ColumnName: "message", Value: errMsg},
+                       },
                        dal.Where("status = ?", models.TASK_RUNNING),
                )
                if err != nil {
                        panic(err)
                }
-               err = db.UpdateColumn(
+               err = db.UpdateColumns(
                        &models.Task{},
-                       "status", models.TASK_FAILED,
+                       []dal.DalSet{
+                               {ColumnName: "status", Value: 
models.TASK_FAILED},
+                               {ColumnName: "message", Value: errMsg},
+                       },
                        dal.Where("status = ?", models.TASK_RUNNING),
                )
                if err != nil {

Reply via email to