diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-12-09 13:34:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 13:34:37 +0000 |
commit | d9b3035342fe3b432bfbdf46d9f5a411d9cd9d39 (patch) | |
tree | 9a6e14537a5ae645dd76cf2a461bebe3249530f4 | |
parent | f64c8822bc5b930d65ef32792df4d7b279143bce (diff) |
Adjust latest events updater (#1623)
* Adjust forward elatest events updater
* Populate newLatest in all cases
* Re-add existingPrevs loop
-rw-r--r-- | roomserver/internal/input/input_latest_events.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index 3608ef4b..9554bf33 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -285,15 +285,15 @@ func (u *latestEventsUpdater) calculateLatest( // then do nothing - it's not a candidate to be a new extremity if // it has been referenced. if _, ok := existingPrevs[newEvent.EventID()]; ok { + u.latest = oldLatest return false, nil } // If the "new" event is already a forward extremity then stop, as // nothing changes. - for _, event := range events { - if event.EventID() == newEvent.EventID() { - return false, nil - } + if _, ok := existingRefs[newEvent.EventID()]; ok { + u.latest = oldLatest + return false, nil } // Include our new event in the extremities. |