From cc2f8a799b1d03ac9f5ab30e297b21c101dfb0ad Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 21 Jan 2022 15:32:59 +0000 Subject: [PATCH] Tweaks --- roomserver/internal/input/input_events.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index a7e06c85..17c421ed 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -168,6 +168,9 @@ func (r *Inputer) processRoomEvent( missingPrev := len(missingRes.MissingPrevEventIDs) > 0 if missingPrev && input.Kind == api.KindNew { + // Don't do this for KindOld events, otherwise old events that we fetch + // to satisfy missing prev events/state will end up recursively calling + // processRoomEvent. if len(serverRes.ServerNames) > 0 { missingState := missingStateReq{ origin: input.Origin, @@ -228,7 +231,7 @@ func (r *Inputer) processRoomEvent( // We haven't calculated a state for this event yet. // Lets calculate one. err = r.calculateAndSetState(ctx, input, roomInfo, &stateAtEvent, event, isRejected) - if err != nil && input.Kind != api.KindOld { + if err != nil { return fmt.Errorf("r.calculateAndSetState: %w", err) } }