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 a08a2e726 fix: close starrocks conn (#4243)
a08a2e726 is described below

commit a08a2e726753e59b493644c7e4910b3b5404d1aa
Author: long2ice <[email protected]>
AuthorDate: Fri Jan 20 18:40:06 2023 +0800

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

diff --git a/plugins/starrocks/tasks.go b/plugins/starrocks/tasks.go
index 044854019..4ccb55b57 100644
--- a/plugins/starrocks/tasks.go
+++ b/plugins/starrocks/tasks.go
@@ -183,6 +183,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 {
@@ -204,7 +210,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