From 901fcec288d75a4c2cbebd59f57547f81f4e53bb Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 18 Aug 2017 11:55:22 +0100 Subject: [PATCH] Add some docstring for withTransaction --- src/github.com/matrix-org/dendrite/roomserver/input/events.go | 3 +++ 1 file changed, 3 insertions(+) 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 {