mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-25 14:38:28 +00:00
Fix potential connection leak (#3247)
We didn't rollback/commit after getting events, now we're rolling back since we didn't change anything.
This commit is contained in:
parent
5f872f4a82
commit
ee73a90aea
1 changed files with 2 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue