diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2023-11-08 14:22:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 14:22:20 +0100 |
commit | ee73a90aea8349e2695ce555ac868bbf45c11d02 (patch) | |
tree | cfb01b64ae2c1213e9f548d4f05e89b070398f7e /syncapi | |
parent | 5f872f4a828eef28c6332d3fb7e8368380261f27 (diff) |
Fix potential connection leak (#3247)
We didn't rollback/commit after getting events, now we're rolling back
since we didn't change anything.
Diffstat (limited to 'syncapi')
-rw-r--r-- | syncapi/routing/getevent.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/syncapi/routing/getevent.go b/syncapi/routing/getevent.go index c089539f..d0227f4e 100644 --- a/syncapi/routing/getevent.go +++ b/syncapi/routing/getevent.go @@ -44,7 +44,7 @@ func GetEvent( rsAPI api.SyncRoomserverAPI, ) util.JSONResponse { ctx := req.Context() - db, err := syncDB.NewDatabaseTransaction(ctx) + db, err := syncDB.NewDatabaseSnapshot(ctx) logger := util.GetLogger(ctx).WithFields(logrus.Fields{ "event_id": eventID, "room_id": rawRoomID, @@ -56,6 +56,7 @@ func GetEvent( JSON: spec.InternalServerError{}, } } + defer db.Rollback() // nolint: errcheck roomID, err := spec.NewRoomID(rawRoomID) if err != nil { |