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