mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
Return a non-fatal error to the federation API on a state regression (#1498)
* Return a non-fatal error to the federation API on a state regression * Return no error but don't morph state
This commit is contained in:
parent
3e12f6e9c2
commit
429bd48129
@ -236,10 +236,13 @@ func (u *latestEventsUpdater) latestState() error {
|
|||||||
if len(u.removed) > len(u.added) {
|
if len(u.removed) > len(u.added) {
|
||||||
// This really shouldn't happen.
|
// This really shouldn't happen.
|
||||||
// TODO: What is ultimately the best way to handle this situation?
|
// TODO: What is ultimately the best way to handle this situation?
|
||||||
return fmt.Errorf(
|
logrus.Errorf(
|
||||||
"invalid state delta wants to remove %d state but only add %d state (between state snapshots %d and %d)",
|
"Invalid state delta on event %q wants to remove %d state but only add %d state (between state snapshots %d and %d)",
|
||||||
len(u.removed), len(u.added), u.oldStateNID, u.newStateNID,
|
u.event.EventID(), len(u.removed), len(u.added), u.oldStateNID, u.newStateNID,
|
||||||
)
|
)
|
||||||
|
u.added = u.added[:0]
|
||||||
|
u.removed = u.removed[:0]
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also work out the state before the event removes and the event
|
// Also work out the state before the event removes and the event
|
||||||
|
Loading…
Reference in New Issue
Block a user