mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Adjust latest events updater (#1623)
* Adjust forward elatest events updater * Populate newLatest in all cases * Re-add existingPrevs loop
This commit is contained in:
parent
f64c8822bc
commit
d9b3035342
1 changed files with 4 additions and 4 deletions
|
@ -285,15 +285,15 @@ func (u *latestEventsUpdater) calculateLatest(
|
||||||
// then do nothing - it's not a candidate to be a new extremity if
|
// then do nothing - it's not a candidate to be a new extremity if
|
||||||
// it has been referenced.
|
// it has been referenced.
|
||||||
if _, ok := existingPrevs[newEvent.EventID()]; ok {
|
if _, ok := existingPrevs[newEvent.EventID()]; ok {
|
||||||
|
u.latest = oldLatest
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the "new" event is already a forward extremity then stop, as
|
// If the "new" event is already a forward extremity then stop, as
|
||||||
// nothing changes.
|
// nothing changes.
|
||||||
for _, event := range events {
|
if _, ok := existingRefs[newEvent.EventID()]; ok {
|
||||||
if event.EventID() == newEvent.EventID() {
|
u.latest = oldLatest
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include our new event in the extremities.
|
// Include our new event in the extremities.
|
||||||
|
|
Loading…
Reference in a new issue