mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 05:12:46 +00:00
Modify sync transaction behaviour (#2758)
This now uses a transaction per stream, so that errors in one stream don't propagate to another, and we therefore no longer need to do hacks to reopen a new transaction after aborting a failed one.
This commit is contained in:
parent
d4710217f8
commit
d32f60249d
11 changed files with 155 additions and 91 deletions
|
@ -29,7 +29,6 @@ import (
|
|||
|
||||
type DatabaseTransaction interface {
|
||||
sqlutil.Transaction
|
||||
Reset() (err error)
|
||||
SharedUsers
|
||||
|
||||
MaxStreamPositionForPDUs(ctx context.Context) (types.StreamPosition, error)
|
||||
|
|
|
@ -31,19 +31,6 @@ func (d *DatabaseTransaction) Rollback() error {
|
|||
return d.txn.Rollback()
|
||||
}
|
||||
|
||||
func (d *DatabaseTransaction) Reset() (err error) {
|
||||
if d.txn == nil {
|
||||
return nil
|
||||
}
|
||||
if err = d.txn.Rollback(); err != nil {
|
||||
return err
|
||||
}
|
||||
if d.txn, err = d.DB.BeginTx(d.ctx, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (d *DatabaseTransaction) MaxStreamPositionForPDUs(ctx context.Context) (types.StreamPosition, error) {
|
||||
id, err := d.OutputEvents.SelectMaxEventID(ctx, d.txn)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue