mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-09 07:03:10 -06:00
Revert changes to room updater
This commit is contained in:
parent
d6de8d2a6f
commit
b4dbd24da5
|
|
@ -11,11 +11,12 @@ import (
|
|||
|
||||
type RoomUpdater struct {
|
||||
transaction
|
||||
d *Database
|
||||
roomInfo *types.RoomInfo
|
||||
latestEvents []types.StateAtEventAndReference
|
||||
lastEventIDSent string
|
||||
roomExists bool
|
||||
d *Database
|
||||
roomInfo *types.RoomInfo
|
||||
latestEvents []types.StateAtEventAndReference
|
||||
lastEventIDSent string
|
||||
currentStateSnapshotNID types.StateSnapshotNID
|
||||
roomExists bool
|
||||
}
|
||||
|
||||
func rollback(txn *sql.Tx) {
|
||||
|
|
@ -33,11 +34,11 @@ func NewRoomUpdater(ctx context.Context, d *Database, txn *sql.Tx, roomInfo *typ
|
|||
// succeed, processing a create event which creates the room, or it won't.
|
||||
if roomInfo == nil {
|
||||
return &RoomUpdater{
|
||||
transaction{ctx, txn}, d, nil, nil, "", false,
|
||||
transaction{ctx, txn}, d, nil, nil, "", 0, false,
|
||||
}, nil
|
||||
}
|
||||
|
||||
eventNIDs, lastEventNIDSent, _, err :=
|
||||
eventNIDs, lastEventNIDSent, currentStateSnapshotNID, err :=
|
||||
d.RoomsTable.SelectLatestEventsNIDsForUpdate(ctx, txn, roomInfo.RoomNID)
|
||||
if err != nil {
|
||||
rollback(txn)
|
||||
|
|
@ -57,7 +58,7 @@ func NewRoomUpdater(ctx context.Context, d *Database, txn *sql.Tx, roomInfo *typ
|
|||
}
|
||||
}
|
||||
return &RoomUpdater{
|
||||
transaction{ctx, txn}, d, roomInfo, stateAndRefs, lastEventIDSent, true,
|
||||
transaction{ctx, txn}, d, roomInfo, stateAndRefs, lastEventIDSent, currentStateSnapshotNID, true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +100,7 @@ func (u *RoomUpdater) LastEventIDSent() string {
|
|||
|
||||
// CurrentStateSnapshotNID implements types.RoomRecentEventsUpdater
|
||||
func (u *RoomUpdater) CurrentStateSnapshotNID() types.StateSnapshotNID {
|
||||
return u.roomInfo.StateSnapshotNID()
|
||||
return u.currentStateSnapshotNID
|
||||
}
|
||||
|
||||
// StorePreviousEvents implements types.RoomRecentEventsUpdater - This must be called from a Writer
|
||||
|
|
|
|||
Loading…
Reference in a new issue