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

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


The following commit(s) were added to refs/heads/release-v0.15 by this push:
     new c5d4adbfd fix: close starrocks conn (#4244) (#4266)
c5d4adbfd is described below

commit c5d4adbfd3789675b5d13fc25103e09c4f1c661c
Author: long2ice <[email protected]>
AuthorDate: Mon Jan 30 14:30:03 2023 +0800

    fix: close starrocks conn (#4244) (#4266)
---
 plugins/starrocks/tasks/tasks.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/plugins/starrocks/tasks/tasks.go b/plugins/starrocks/tasks/tasks.go
index e6cdf7142..0d00e464e 100644
--- a/plugins/starrocks/tasks/tasks.go
+++ b/plugins/starrocks/tasks/tasks.go
@@ -185,6 +185,12 @@ func createTmpTable(starrocks *sql.DB, db dal.Dal, 
starrocksTable string, starro
        }
        firstcm := ""
        firstcmName := ""
+       var rowsInStarRocks *sql.Rows
+       defer func() {
+               if rowsInStarRocks != nil {
+                       rowsInStarRocks.Close()
+               }
+       }()
        for _, cm := range columnMetas {
                name := cm.Name()
                if name == updateColumn {
@@ -206,7 +212,7 @@ func createTmpTable(starrocks *sql.DB, db dal.Dal, 
starrocksTable string, starro
                                }
                        }
                        var starrocksErr error
-                       rowsInStarRocks, starrocksErr := 
starrocks.Query(fmt.Sprintf("select %s from %s order by %s desc limit 1", 
updateColumn, starrocksTable, updateColumn))
+                       rowsInStarRocks, starrocksErr = 
starrocks.Query(fmt.Sprintf("select %s from %s order by %s desc limit 1", 
updateColumn, starrocksTable, updateColumn))
                        if starrocksErr != nil {
                                if !strings.Contains(starrocksErr.Error(), 
"Unknown table") {
                                        return nil, "", false, 
errors.Convert(starrocksErr)

Reply via email to