Skip to content

Commit

Permalink
fix(api): add missing rows.Close() (#4598)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored and richardlt committed Sep 11, 2019
1 parent 032e222 commit 65387a5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions engine/api/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,19 @@ func actionAuditCleaner(db *gorp.DbMap) error {
if err != nil {
return err
}
defer rows.Close() // nolint
var toDel []int64
var actionID, count int64
for rows.Next() {
err = rows.Scan(&actionID, &count)
if err != nil {
rows.Close()
return err
}

if count > maxVersion {
toDel = append(toDel, actionID)
}
}
rows.Close()

// Now delete older version to keep only 20
query = `DELETE FROM action_audit
Expand Down
1 change: 1 addition & 0 deletions engine/api/broadcast/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func LoadAll(db gorp.SqlExecutor, u *sdk.User) ([]sdk.Broadcast, error) {
if err != nil {
return nil, sdk.WrapError(err, "Cannot query")
}
defer rows.Close() // nolint

broadcasts := []sdk.Broadcast{}
for rows.Next() {
Expand Down
1 change: 1 addition & 0 deletions engine/api/workflow/execute_node_job_run_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func LoadLogs(db gorp.SqlExecutor, id int64) ([]sdk.Log, error) {
if err != nil {
return nil, err
}
defer rows.Close() // nolint
var logs []sdk.Log
for rows.Next() {
l := &sdk.Log{}
Expand Down
1 change: 1 addition & 0 deletions engine/api/workflow/execute_node_job_run_log_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func LoadServicesLogsByJob(db gorp.SqlExecutor, nodeJobRunID int64) ([]sdk.Servi
if err != nil {
return nil, err
}
defer rows.Close() // nolint

var logs []sdk.ServiceLog
for rows.Next() {
Expand Down

0 comments on commit 65387a5

Please sign in to comment.