mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Only do this for non-state events, since state events will always result in state change at extremities
This commit is contained in:
parent
3b67ac7327
commit
c82a72b179
|
|
@ -204,30 +204,32 @@ func (u *latestEventsUpdater) latestState() error {
|
||||||
// Work out if the state at the extremities has actually changed
|
// Work out if the state at the extremities has actually changed
|
||||||
// or not. If they haven't then we won't bother doing all of the
|
// or not. If they haven't then we won't bother doing all of the
|
||||||
// hard work.
|
// hard work.
|
||||||
stateChanged := false
|
if u.event.StateKey() == nil {
|
||||||
oldStateNIDs := make([]types.StateSnapshotNID, 0, len(u.oldLatest))
|
stateChanged := false
|
||||||
newStateNIDs := make([]types.StateSnapshotNID, 0, len(u.latest))
|
oldStateNIDs := make([]types.StateSnapshotNID, 0, len(u.oldLatest))
|
||||||
for _, old := range u.oldLatest {
|
newStateNIDs := make([]types.StateSnapshotNID, 0, len(u.latest))
|
||||||
oldStateNIDs = append(oldStateNIDs, old.BeforeStateSnapshotNID)
|
for _, old := range u.oldLatest {
|
||||||
}
|
oldStateNIDs = append(oldStateNIDs, old.BeforeStateSnapshotNID)
|
||||||
for _, new := range u.latest {
|
}
|
||||||
newStateNIDs = append(newStateNIDs, new.BeforeStateSnapshotNID)
|
for _, new := range u.latest {
|
||||||
}
|
newStateNIDs = append(newStateNIDs, new.BeforeStateSnapshotNID)
|
||||||
oldStateNIDs = state.UniqueStateSnapshotNIDs(oldStateNIDs)
|
}
|
||||||
newStateNIDs = state.UniqueStateSnapshotNIDs(newStateNIDs)
|
oldStateNIDs = state.UniqueStateSnapshotNIDs(oldStateNIDs)
|
||||||
if len(oldStateNIDs) != len(newStateNIDs) {
|
newStateNIDs = state.UniqueStateSnapshotNIDs(newStateNIDs)
|
||||||
stateChanged = true
|
if len(oldStateNIDs) != len(newStateNIDs) {
|
||||||
} else {
|
stateChanged = true
|
||||||
for i := range oldStateNIDs {
|
} else {
|
||||||
if oldStateNIDs[i] != newStateNIDs[i] {
|
for i := range oldStateNIDs {
|
||||||
stateChanged = true
|
if oldStateNIDs[i] != newStateNIDs[i] {
|
||||||
break
|
stateChanged = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if !stateChanged {
|
||||||
if !stateChanged {
|
u.newStateNID = u.oldStateNID
|
||||||
u.newStateNID = u.oldStateNID
|
return nil
|
||||||
return nil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of the current latest events. This may or may not
|
// Get a list of the current latest events. This may or may not
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue