aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-10-08 12:13:50 +0100
committerGitHub <noreply@github.com>2020-10-08 12:13:50 +0100
commit429bd48129b375c853dec5416212d44dd14cc0db (patch)
tree19a6f2ac624a1497b01ca95074f5bbeb12a81dc5
parent3e12f6e9c210824ecd80c5c4dcccabf742eb4183 (diff)
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
-rw-r--r--roomserver/internal/input/input_latest_events.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go
index 7be6372b..9c6e6a25 100644
--- a/roomserver/internal/input/input_latest_events.go
+++ b/roomserver/internal/input/input_latest_events.go
@@ -236,10 +236,13 @@ func (u *latestEventsUpdater) latestState() error {
if len(u.removed) > len(u.added) {
// This really shouldn't happen.
// TODO: What is ultimately the best way to handle this situation?
- return fmt.Errorf(
- "invalid state delta 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,
+ logrus.Errorf(
+ "Invalid state delta on event %q wants to remove %d state but only add %d state (between state snapshots %d and %d)",
+ 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