mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-22 14:21:55 -06: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
|
@ -44,7 +44,7 @@ func GetEvent(
|
||||||
rsAPI api.SyncRoomserverAPI,
|
rsAPI api.SyncRoomserverAPI,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
ctx := req.Context()
|
ctx := req.Context()
|
||||||
db, err := syncDB.NewDatabaseTransaction(ctx)
|
db, err := syncDB.NewDatabaseSnapshot(ctx)
|
||||||
logger := util.GetLogger(ctx).WithFields(logrus.Fields{
|
logger := util.GetLogger(ctx).WithFields(logrus.Fields{
|
||||||
"event_id": eventID,
|
"event_id": eventID,
|
||||||
"room_id": rawRoomID,
|
"room_id": rawRoomID,
|
||||||
|
@ -56,6 +56,7 @@ func GetEvent(
|
||||||
JSON: spec.InternalServerError{},
|
JSON: spec.InternalServerError{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
defer db.Rollback() // nolint: errcheck
|
||||||
|
|
||||||
roomID, err := spec.NewRoomID(rawRoomID)
|
roomID, err := spec.NewRoomID(rawRoomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue