mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 00:03:09 -06:00
Adjust forward elatest events updater
This commit is contained in:
parent
f64c8822bc
commit
0c86d974b2
|
|
@ -290,11 +290,9 @@ func (u *latestEventsUpdater) calculateLatest(
|
|||
|
||||
// If the "new" event is already a forward extremity then stop, as
|
||||
// nothing changes.
|
||||
for _, event := range events {
|
||||
if event.EventID() == newEvent.EventID() {
|
||||
if _, ok := existingRefs[newEvent.EventID()]; ok {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Include our new event in the extremities.
|
||||
newLatest := []types.StateAtEventAndReference{newStateAndRef}
|
||||
|
|
@ -306,14 +304,6 @@ func (u *latestEventsUpdater) calculateLatest(
|
|||
delete(existingRefs, prevEventID)
|
||||
}
|
||||
|
||||
// Ensure that we don't add any candidate forward extremities from
|
||||
// the old set that are, themselves, referenced by the old set of
|
||||
// forward extremities. This shouldn't happen but guards against
|
||||
// the possibility anyway.
|
||||
for prevEventID := range existingPrevs {
|
||||
delete(existingRefs, prevEventID)
|
||||
}
|
||||
|
||||
// Then re-add any old extremities that are still valid after all.
|
||||
for _, old := range existingRefs {
|
||||
newLatest = append(newLatest, *old)
|
||||
|
|
|
|||
Loading…
Reference in a new issue