mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Fix broken /sync
due to transaction error
This commit is contained in:
parent
aa8ec1acbf
commit
ee40a29e55
15 changed files with 45 additions and 8 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"github.com/matrix-org/dendrite/syncapi/storage"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
@ -323,7 +324,8 @@ func (n *Notifier) Load(ctx context.Context, db storage.Database) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer snapshot.Rollback() // nolint:errcheck
|
||||
var succeeded bool
|
||||
defer sqlutil.EndTransactionWithCheck(snapshot, &succeeded, &err)
|
||||
|
||||
roomToUsers, err := snapshot.AllJoinedUsersInRooms(ctx)
|
||||
if err != nil {
|
||||
|
@ -337,6 +339,7 @@ func (n *Notifier) Load(ctx context.Context, db storage.Database) error {
|
|||
}
|
||||
n.setPeekingDevices(roomToPeekingDevices)
|
||||
|
||||
succeeded = true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -349,7 +352,8 @@ func (n *Notifier) LoadRooms(ctx context.Context, db storage.Database, roomIDs [
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer snapshot.Rollback() // nolint:errcheck
|
||||
var succeeded bool
|
||||
defer sqlutil.EndTransactionWithCheck(snapshot, &succeeded, &err)
|
||||
|
||||
roomToUsers, err := snapshot.AllJoinedUsersInRoom(ctx, roomIDs)
|
||||
if err != nil {
|
||||
|
@ -357,6 +361,7 @@ func (n *Notifier) LoadRooms(ctx context.Context, db storage.Database, roomIDs [
|
|||
}
|
||||
n.setUsersJoinedToRooms(roomToUsers)
|
||||
|
||||
succeeded = true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue