From ecee5f10f49487f0b6628fea065914ea3e685a79 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 5 Sep 2022 17:08:54 +0100 Subject: [PATCH] Tweak logging for detected state resets --- roomserver/internal/input/input_latest_events.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index ec662672..7a4105ab 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -275,7 +275,7 @@ func (u *latestEventsUpdater) latestState() error { return fmt.Errorf("roomState.DifferenceBetweenStateSnapshots: %w", err) } - if removed := len(u.removed) - len(u.added); removed > 0 { + if removed := len(u.removed) - len(u.added); !u.rewritesState && removed > 0 { logrus.WithFields(logrus.Fields{ "event_id": u.event.EventID(), "room_id": u.event.RoomID(), @@ -283,7 +283,7 @@ func (u *latestEventsUpdater) latestState() error { "new_state_nid": u.newStateNID, "old_latest": u.oldLatest.EventIDs(), "new_latest": u.latest.EventIDs(), - }).Errorf("Unexpected state deletion (removing %d events)", removed) + }).Warnf("State reset detected (removing %d events)", removed) } // Also work out the state before the event removes and the event