Consistency

This commit is contained in:
Neil Alexander 2020-10-21 17:47:13 +01:00
parent 6c2a5b4d76
commit eb0ce0cbf2
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 9 additions and 11 deletions

View file

@ -163,13 +163,13 @@ func (r *Inputer) processRoomEvent(
switch input.Kind {
case api.KindNew:
if err = r.updateLatestEvents(
ctx, // context
roomInfo, // room info for the room being updated
stateAtEvent, // state at event (below)
event, // event
input.SendAsServer, // send as server
input.TransactionID, // transaction ID
input.HasState, // rewrites state?
ctx, // context
roomInfo, // room info for the room being updated
stateAtEvent, // state at event (below)
event, // event
input.SendAsServer, // send as server
input.TransactionID, // transaction ID
stateAtEvent.Overwrite, // rewrites state?
); err != nil {
return "", fmt.Errorf("r.updateLatestEvents: %w", err)
}

View file

@ -117,9 +117,6 @@ type latestEventsUpdater struct {
// nolint:gocyclo
func (u *latestEventsUpdater) doUpdateLatestEvents() error {
u.lastEventIDSent = u.updater.LastEventIDSent()
if !u.stateAtEvent.Overwrite {
u.oldStateNID = u.updater.CurrentStateSnapshotNID()
}
// If we are doing a regular event update then we will get the
// previous latest events to use as a part of the calculation. If
@ -128,7 +125,8 @@ func (u *latestEventsUpdater) doUpdateLatestEvents() error {
// then start with an empty set - none of the forward extremities
// that we knew about before matter anymore.
oldLatest := []types.StateAtEventAndReference{}
if !u.stateAtEvent.Overwrite {
if !u.rewritesState {
u.oldStateNID = u.updater.CurrentStateSnapshotNID()
oldLatest = u.updater.LatestEvents()
}