This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v0.14
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.14 by this push:
new 742db139 fix: close db connections after starrocks sync finish (#3669)
742db139 is described below
commit 742db1391e4f8b02b528193c6245b9c0a22b0e24
Author: long2ice <[email protected]>
AuthorDate: Fri Nov 4 11:15:16 2022 +0800
fix: close db connections after starrocks sync finish (#3669)
* 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 acf2b1b7..841fc1f6 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, "_")