diff --git a/src/github.com/matrix-org/dendrite/roomserver/input/events.go b/src/github.com/matrix-org/dendrite/roomserver/input/events.go index 66026032e..c16de5e6f 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/input/events.go +++ b/src/github.com/matrix-org/dendrite/roomserver/input/events.go @@ -165,6 +165,9 @@ func processInviteEvent(db RoomEventDatabase, ow OutputRoomEventWriter, input ap }) } +// withTransaction runs a function inside a transaction. +// Commits the transaction if the function succeeds. +// Rollsback the transaction if the function fails or panics. func withTransaction(t types.Transaction, f func() error) (err error) { defer func() { if r := recover(); r != nil {