diff options
author | Prateek Sachan <42961174+prateek2211@users.noreply.github.com> | 2020-03-18 15:47:18 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-18 10:17:18 +0000 |
commit | c019ad708669a4c269072bea933f0a520a78ca7c (patch) | |
tree | 99b4cd6f06b6d3a1db8fa66666e715fd6cd12e58 /mediaapi/storage | |
parent | c2bd0b97b34c9040325bf31c5c4a2a06579239d9 (diff) |
Log errors from rows.Close (#920)
* Log errors from rows.Close
* fixed imports
* Added contextual messages
* fixed review changes
Diffstat (limited to 'mediaapi/storage')
-rw-r--r-- | mediaapi/storage/postgres/thumbnail_table.go | 4 | ||||
-rw-r--r-- | mediaapi/storage/sqlite3/thumbnail_table.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/mediaapi/storage/postgres/thumbnail_table.go b/mediaapi/storage/postgres/thumbnail_table.go index 127b86bb..08bddc36 100644 --- a/mediaapi/storage/postgres/thumbnail_table.go +++ b/mediaapi/storage/postgres/thumbnail_table.go @@ -20,6 +20,8 @@ import ( "database/sql" "time" + "github.com/matrix-org/dendrite/common" + "github.com/matrix-org/dendrite/mediaapi/types" "github.com/matrix-org/gomatrixserverlib" ) @@ -144,7 +146,7 @@ func (s *thumbnailStatements) selectThumbnails( if err != nil { return nil, err } - defer rows.Close() // nolint: errcheck + defer common.CloseAndLogIfError(ctx, rows, "selectThumbnails: rows.close() failed") var thumbnails []*types.ThumbnailMetadata for rows.Next() { diff --git a/mediaapi/storage/sqlite3/thumbnail_table.go b/mediaapi/storage/sqlite3/thumbnail_table.go index 95332c9d..280fafe8 100644 --- a/mediaapi/storage/sqlite3/thumbnail_table.go +++ b/mediaapi/storage/sqlite3/thumbnail_table.go @@ -20,6 +20,8 @@ import ( "database/sql" "time" + "github.com/matrix-org/dendrite/common" + "github.com/matrix-org/dendrite/mediaapi/types" "github.com/matrix-org/gomatrixserverlib" ) @@ -134,7 +136,7 @@ func (s *thumbnailStatements) selectThumbnails( if err != nil { return nil, err } - defer rows.Close() // nolint: errcheck + defer common.CloseAndLogIfError(ctx, rows, "selectThumbnails: rows.close() failed") var thumbnails []*types.ThumbnailMetadata for rows.Next() { |