mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 21:33:19 -06:00
Handle nil in transaction
This commit is contained in:
parent
a420a4f072
commit
7c63b5cbb4
|
|
@ -43,10 +43,18 @@ type transaction struct {
|
||||||
|
|
||||||
// Commit implements types.Transaction
|
// Commit implements types.Transaction
|
||||||
func (t *transaction) Commit() error {
|
func (t *transaction) Commit() error {
|
||||||
|
if t.txn == nil {
|
||||||
|
// The Updater structs can operate in useTxns=false mode. The code will still call this though.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return t.txn.Commit()
|
return t.txn.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rollback implements types.Transaction
|
// Rollback implements types.Transaction
|
||||||
func (t *transaction) Rollback() error {
|
func (t *transaction) Rollback() error {
|
||||||
|
if t.txn == nil {
|
||||||
|
// The Updater structs can operate in useTxns=false mode. The code will still call this though.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return t.txn.Rollback()
|
return t.txn.Rollback()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue