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 2022/11/04 03:14:53 UTC

[incubator-devlake] branch main updated: fix: close db connections after starrocks sync finish (#3668)

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 9b0ac522 fix: close db connections after starrocks sync finish (#3668)
9b0ac522 is described below

commit 9b0ac522b56809f6da201f2948fa8fd60f961ee1
Author: long2ice <ji...@merico.dev>
AuthorDate: Fri Nov 4 11:14:50 2022 +0800

    fix: close db connections after starrocks sync finish (#3668)
    
    * fix: close db connections after starrocks sync finish
    
    * ci: fix lint error
---
 plugins/starrocks/tasks.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plugins/starrocks/tasks.go b/plugins/starrocks/tasks.go
index c0033d6b..030fa9b8 100644
--- a/plugins/starrocks/tasks.go
+++ b/plugins/starrocks/tasks.go
@@ -66,6 +66,11 @@ func LoadData(c core.SubTaskContext) errors.Error {
 			return errors.NotFound.New(fmt.Sprintf("unsupported source type %s", config.SourceType))
 		}
 		db = dalgorm.NewDalgorm(o)
+		sqlDB, err := o.DB()
+		if err != nil {
+			return errors.Convert(err)
+		}
+		defer sqlDB.Close()
 	} else {
 		db = c.GetDal()
 	}
@@ -103,6 +108,7 @@ func LoadData(c core.SubTaskContext) errors.Error {
 	if err != nil {
 		return errors.Convert(err)
 	}
+	defer starrocks.Close()
 
 	for _, table := range starrocksTables {
 		starrocksTable := strings.TrimLeft(table, "_")