You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "klesh (via GitHub)" <gi...@apache.org> on 2023/01/30 08:12:20 UTC

[GitHub] [incubator-devlake] klesh commented on a diff in pull request #4273: fix: close pg conn

klesh commented on code in PR #4273:
URL: https://github.com/apache/incubator-devlake/pull/4273#discussion_r1090286254


##########
backend/plugins/starrocks/tasks/tasks.go:
##########
@@ -186,16 +186,20 @@ func createTmpTable(starrocks *sql.DB, db dal.Dal, starrocksTable string, starro
 	firstcm := ""
 	firstcmName := ""
 	var rowsInStarRocks *sql.Rows
+	var rowsInPostgres dal.Rows
 	defer func() {
 		if rowsInStarRocks != nil {
 			rowsInStarRocks.Close()
 		}
+		if rowsInPostgres != nil {
+			rowsInPostgres.Close()
+		}
 	}()
 	for _, cm := range columnMetas {
 		name := cm.Name()
 		if name == updateColumn {
 			// check update column to detect skip or not
-			rows, err := db.Cursor(
+			rowsInPostgres, err = db.Cursor(

Review Comment:
    I believe we should close the cursor before assigning new one to the variable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org