mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 01:13:10 -06:00
Add some docstring for withTransaction
This commit is contained in:
parent
47a23e1a0c
commit
901fcec288
|
|
@ -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) {
|
func withTransaction(t types.Transaction, f func() error) (err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue