Log errors from rows.Close (#920)

* Log errors from rows.Close

* fixed imports

* Added contextual messages

* fixed review changes
This commit is contained in:
Prateek Sachan 2020-03-18 15:47:18 +05:30 committed by GitHub
parent c2bd0b97b3
commit c019ad7086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 118 additions and 69 deletions

View file

@ -19,6 +19,8 @@ import (
"context"
"database/sql"
"github.com/matrix-org/dendrite/common"
"github.com/lib/pq"
"github.com/matrix-org/gomatrixserverlib"
)
@ -91,7 +93,7 @@ func (s *serverKeyStatements) bulkSelectServerKeys(
if err != nil {
return nil, err
}
defer rows.Close() // nolint: errcheck
defer common.CloseAndLogIfError(ctx, rows, "bulkSelectServerKeys: rows.close() failed")
results := map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult{}
for rows.Next() {
var serverName string

View file

@ -124,7 +124,7 @@ func (s *serverKeyStatements) bulkSelectServerKeys(
if err != nil {
return nil, err
}
defer rows.Close() // nolint: errcheck
defer common.CloseAndLogIfError(ctx, rows, "bulkSelectServerKeys: rows.close() failed")
results := map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult{}
for rows.Next() {
var serverName string