mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 14:53:10 -06:00
Commit/rollback sync API transactions in writer
This commit is contained in:
parent
668a722ee0
commit
9a1491c5ed
|
|
@ -427,7 +427,11 @@ func (d *Database) addPDUDeltaToResponse(
|
|||
return nil, err
|
||||
}
|
||||
succeeded := false
|
||||
defer sqlutil.EndTransactionWithCheck(txn, &succeeded, &err)
|
||||
defer func() {
|
||||
_ = d.Writer.Do(d.DB, txn, func(txn *sql.Tx) error {
|
||||
return sqlutil.EndTransactionWithCheck(txn, &succeeded, &err)
|
||||
})
|
||||
}()
|
||||
|
||||
stateFilter := gomatrixserverlib.DefaultStateFilter() // TODO: use filter provided in request
|
||||
|
||||
|
|
@ -620,7 +624,11 @@ func (d *Database) getResponseWithPDUsForCompleteSync(
|
|||
return
|
||||
}
|
||||
succeeded := false
|
||||
defer sqlutil.EndTransactionWithCheck(txn, &succeeded, &err)
|
||||
defer func() {
|
||||
_ = d.Writer.Do(d.DB, txn, func(txn *sql.Tx) error {
|
||||
return sqlutil.EndTransactionWithCheck(txn, &succeeded, &err)
|
||||
})
|
||||
}()
|
||||
|
||||
// Get the current sync position which we will base the sync response on.
|
||||
toPos, err = d.syncPositionTx(ctx, txn)
|
||||
|
|
|
|||
Loading…
Reference in a new issue