Skip to content

Commit

Permalink
apiserver: Close rows before reusing tx
Browse files Browse the repository at this point in the history
Reusing tx before closing rows (might) result in the following error:

[mysql] 2020/02/17 11:55:38 packets.go:427: busy buffer

This closes #3098
  • Loading branch information
discordianfish committed Feb 17, 2020
1 parent d0ef0ae commit 9394ef3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/src/apiserver/storage/db_status_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ func (s *DBStatusStore) InitializeDBStatusTable() error {
tx.Rollback()
return util.NewInternalServerError(err, "Failed to load database status.")
}
defer rows.Close()
next := rows.Next()
rows.Close()

// The table is not initialized
if !rows.Next() {
if !next {
sql, args, queryErr := sq.
Insert("db_statuses").
SetMap(defaultDBStatus).
Expand Down

0 comments on commit 9394ef3

Please sign in to comment.