diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-09-13 12:52:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 12:52:09 +0100 |
commit | b05e028f7d8befc045dcb62e87d09ad462bb277c (patch) | |
tree | ac402b3a283cfacc59c1af67da87581d812fab56 /syncapi | |
parent | 3e55856254f6bc918f5075d7adb85d53da92c7c8 (diff) |
Tweak `LoadMembershipAtEvent` behaviour when state not known (#2716)
Previously `LoadMembershipAtEvent` would fail if the state before one of
the events was not known, i.e. because it was an outlier. This modifies
it so that it gracefully handles not knowing the state and returns no
memberships instead, so that history visibility doesn't freak out and
kill `/sync` requests dead.
Diffstat (limited to 'syncapi')
-rw-r--r-- | syncapi/streams/stream_pdu.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go index ffcf64df..0ab6de88 100644 --- a/syncapi/streams/stream_pdu.go +++ b/syncapi/streams/stream_pdu.go @@ -388,7 +388,7 @@ func applyHistoryVisibilityFilter( if err != nil { // Not a fatal error, we can continue without the stateEvents, // they are only needed if there are state events in the timeline. - logrus.WithError(err).Warnf("failed to get current room state") + logrus.WithError(err).Warnf("Failed to get current room state for history visibility") } alwaysIncludeIDs := make(map[string]struct{}, len(stateEvents)) for _, ev := range stateEvents { @@ -397,7 +397,6 @@ func applyHistoryVisibilityFilter( startTime := time.Now() events, err := internal.ApplyHistoryVisibilityFilter(ctx, db, rsAPI, recentEvents, alwaysIncludeIDs, userID, "sync") if err != nil { - return nil, err } logrus.WithFields(logrus.Fields{ @@ -405,7 +404,7 @@ func applyHistoryVisibilityFilter( "room_id": roomID, "before": len(recentEvents), "after": len(events), - }).Debug("applied history visibility (sync)") + }).Trace("Applied history visibility (sync)") return events, nil } |