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 75b43eaed fix: close starrocks conn (#4244)
75b43eaed is described below

commit 75b43eaede932ab9590863357669a58d8c1f9f9f
Author: long2ice <[email protected]>
AuthorDate: Fri Jan 20 18:40:31 2023 +0800

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

diff --git a/backend/plugins/starrocks/tasks/tasks.go 
b/backend/plugins/starrocks/tasks/tasks.go
index 2edefdc78..2f9cc3a10 100644
--- a/backend/plugins/starrocks/tasks/tasks.go
+++ b/backend/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