aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-01-27 15:52:32 +0000
committerGitHub <noreply@github.com>2022-01-27 15:52:32 +0000
commitb6011d0d87ccbc686e7f6ac2a764a1918352c172 (patch)
tree952e58a6760718a395966c6cf3a495f441aca992
parenta763cbb0e1a12828dade855add9a6c30c784baa8 (diff)
Try federation when backfill fails to find events in the database (#2113)
* Try to backfill via federation in error cases * Cleaner retry for backfill * Simpler condition
-rw-r--r--roomserver/internal/perform/perform_backfill.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/roomserver/internal/perform/perform_backfill.go b/roomserver/internal/perform/perform_backfill.go
index f3623de8..081f694a 100644
--- a/roomserver/internal/perform/perform_backfill.go
+++ b/roomserver/internal/perform/perform_backfill.go
@@ -82,10 +82,14 @@ 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
loadedEvents, err = helpers.LoadEvents(ctx, r.DB, resultNIDs)
if err != nil {
+ if _, ok := err.(types.MissingEventError); ok {
+ return r.backfillViaFederation(ctx, request, response)
+ }
return err
}