Try to backfill via federation in error cases

This commit is contained in:
Neil Alexander 2022-01-27 15:10:30 +00:00
parent a763cbb0e1
commit ae7919c2cf
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -79,21 +79,24 @@ func (r *Backfiller) PerformBackfill(
// Scan the event tree for events to send back.
resultNIDs, err := helpers.ScanEventTree(ctx, r.DB, info, front, visited, request.Limit, request.ServerName)
if err != nil {
return err
return r.backfillViaFederation(ctx, request, response)
}
// Retrieve events from the list that was filled previously.
var loadedEvents []*gomatrixserverlib.Event
loadedEvents, err = helpers.LoadEvents(ctx, r.DB, resultNIDs)
if err != nil {
return err
return r.backfillViaFederation(ctx, request, response)
}
for _, event := range loadedEvents {
response.Events = append(response.Events, event.Headered(info.RoomVersion))
}
return err
if err != nil {
return r.backfillViaFederation(ctx, request, response)
}
return nil
}
func (r *Backfiller) backfillViaFederation(ctx context.Context, req *api.PerformBackfillRequest, res *api.PerformBackfillResponse) error {