mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 11:23:11 -06:00
sqlite: Fix failing federation invite
Was failing with 'database is locked' due to multiple write txns being taken out.
This commit is contained in:
parent
867c59a20a
commit
07128b8423
|
|
@ -608,6 +608,15 @@ func (d *Database) MembershipUpdater(
|
|||
defer func() {
|
||||
if !succeeded {
|
||||
txn.Rollback() // nolint: errcheck
|
||||
} else {
|
||||
// TODO: We should be holding open this transaction but we cannot have
|
||||
// multiple write transactions on sqlite. The code will perform additional
|
||||
// write transactions independent of this one which will consistently cause
|
||||
// 'database is locked' errors. For now, we'll break up the transaction and
|
||||
// hope we don't race too catastrophically. Long term, we should be able to
|
||||
// thread in txn objects where appropriate (either at the interface level or
|
||||
// bring matrix business logic into the storage layer).
|
||||
txn.Commit()
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
@ -655,7 +664,8 @@ func (d *Database) membershipUpdaterTxn(
|
|||
}
|
||||
|
||||
return &membershipUpdater{
|
||||
transaction{ctx, txn}, d, roomNID, targetUserNID, membership,
|
||||
// purposefully set the txn to nil so if we try to use it we panic and fail fast
|
||||
transaction{ctx, nil}, d, roomNID, targetUserNID, membership,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue