Skip to content

Commit

Permalink
Merge pull request #27 from solarisdb/fix_db_conn_deadlock
Browse files Browse the repository at this point in the history
fix the deadlock on db connection pool
  • Loading branch information
trtlmn committed May 7, 2024
2 parents 198c606 + a320b8a commit 17519c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/storage/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ func (s *Storage) QueryLogs(ctx context.Context, qr storage.QueryLogsRequest) (*
if err != nil {
return nil, MapError(err)
}
defer func() {
_ = cntRows.Close()
}()
var count int64
if count, err = scan[int64](cntRows); err != nil {
_ = cntRows.Close()
return nil, MapError(err)
}
// releasing the db connection before requesting a new one for avoiding a deadlock on limited connection pool
_ = cntRows.Close()

limit := int(qr.Limit)
args = append(args, limit+1)
Expand Down

0 comments on commit 17519c8

Please sign in to comment.