Skip to content

Commit

Permalink
Merge pull request #80 from LucaBernstein/fix-too-many-open-conns
Browse files Browse the repository at this point in the history
Remove conn leak by closing connections
  • Loading branch information
LucaBernstein authored Dec 25, 2021
2 parents 6e9bdb8 + 9093308 commit fd3cc5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions bot/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ func (bc *BotController) cronNotifications() {
if err != nil {
bc.Logf(ERROR, nil, "Error getting users to notify: %s", err.Error())
}
defer rows.Close()

var (
tgChatId string
Expand Down
4 changes: 4 additions & 0 deletions db/crud/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func (r *Repo) HealthGetLogs(lastHours int) (errors int, warnings int, err error
if err != nil {
return
}
defer rows.Close()
var (
level int
count int
Expand All @@ -37,6 +38,7 @@ func (r *Repo) HealthGetTransactions() (open int, archived int, err error) {
if err != nil {
return
}
defer rows.Close()
var (
isArchived bool
count int
Expand All @@ -59,6 +61,7 @@ func (r *Repo) HealthGetUserCount() (count int, err error) {
if err != nil {
return
}
defer rows.Close()
if rows.Next() {
rows.Scan(&count)
}
Expand All @@ -73,6 +76,7 @@ func (r *Repo) HealthGetCacheStats() (accTo int, accFrom int, txDesc int, err er
if err != nil {
return
}
defer rows.Close()
var (
t string
count int
Expand Down

0 comments on commit fd3cc5f

Please sign in to comment.