From 6c1848066d51a612c93370f88737498befa2e900 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 27 Jan 2022 15:29:08 +0000 Subject: [PATCH] Simpler condition --- roomserver/internal/perform/perform_backfill.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/roomserver/internal/perform/perform_backfill.go b/roomserver/internal/perform/perform_backfill.go index a84a245a..081f694a 100644 --- a/roomserver/internal/perform/perform_backfill.go +++ b/roomserver/internal/perform/perform_backfill.go @@ -82,18 +82,13 @@ func (r *Backfiller) PerformBackfill( return err } - // Retrieve events from the list that was filled previously. + // Retrieve events from the list that was filled previously. If we fail to get + // events from the database then attempt once to get them from federation instead. var loadedEvents []*gomatrixserverlib.Event - var retried bool -retryLoadEvents: loadedEvents, err = helpers.LoadEvents(ctx, r.DB, resultNIDs) if err != nil { - if _, ok := err.(types.MissingEventError); !retried && ok { - err = r.backfillViaFederation(ctx, request, response) - if err == nil { - retried = true - goto retryLoadEvents - } + if _, ok := err.(types.MissingEventError); ok { + return r.backfillViaFederation(ctx, request, response) } return err }