This commit is contained in:
Neil Alexander 2022-01-21 15:32:59 +00:00
parent ae3c4f3c56
commit cc2f8a799b
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -168,6 +168,9 @@ func (r *Inputer) processRoomEvent(
missingPrev := len(missingRes.MissingPrevEventIDs) > 0 missingPrev := len(missingRes.MissingPrevEventIDs) > 0
if missingPrev && input.Kind == api.KindNew { 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 { if len(serverRes.ServerNames) > 0 {
missingState := missingStateReq{ missingState := missingStateReq{
origin: input.Origin, origin: input.Origin,
@ -228,7 +231,7 @@ func (r *Inputer) processRoomEvent(
// We haven't calculated a state for this event yet. // We haven't calculated a state for this event yet.
// Lets calculate one. // Lets calculate one.
err = r.calculateAndSetState(ctx, input, roomInfo, &stateAtEvent, event, isRejected) 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) return fmt.Errorf("r.calculateAndSetState: %w", err)
} }
} }