aboutsummaryrefslogtreecommitdiff
path: root/roomserver
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-01-05 09:24:00 +0100
committerGitHub <noreply@github.com>2023-01-05 09:24:00 +0100
commit2e1fe589375b650f9b2d9a09e1fcffb3ab6fe5b6 (patch)
tree20457d4084fdbc5b8f910c981927ba3e33dc3cea /roomserver
parente449d174ccf7569b2536289f3c8145298e80bc90 (diff)
Fix backfilling (#2926)
This should fix https://github.com/matrix-org/dendrite/issues/2923
Diffstat (limited to 'roomserver')
-rw-r--r--roomserver/internal/perform/perform_backfill.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/roomserver/internal/perform/perform_backfill.go b/roomserver/internal/perform/perform_backfill.go
index 069f017a..d9214fdc 100644
--- a/roomserver/internal/perform/perform_backfill.go
+++ b/roomserver/internal/perform/perform_backfill.go
@@ -122,11 +122,14 @@ func (r *Backfiller) backfillViaFederation(ctx context.Context, req *api.Perform
ctx, req.VirtualHost, requester,
r.KeyRing, req.RoomID, info.RoomVersion, req.PrevEventIDs(), 100,
)
- if err != nil {
+ // Only return an error if we really couldn't get any events.
+ if err != nil && len(events) == 0 {
logrus.WithError(err).Errorf("gomatrixserverlib.RequestBackfill failed")
return err
}
- logrus.WithField("room_id", req.RoomID).Infof("backfilled %d events", len(events))
+ // If we got an error but still got events, that's fine, because a server might have returned a 404 (or something)
+ // but other servers could provide the missing event.
+ logrus.WithError(err).WithField("room_id", req.RoomID).Infof("backfilled %d events", len(events))
// persist these new events - auth checks have already been done
roomNID, backfilledEventMap := persistEvents(ctx, r.DB, events)
@@ -319,6 +322,7 @@ FederationHit:
FedClient: b.fsAPI,
RememberAuthEvents: false,
Server: srv,
+ Origin: b.virtualHost,
}
res, err := c.StateIDsBeforeEvent(ctx, targetEvent)
if err != nil {
@@ -394,6 +398,7 @@ func (b *backfillRequester) StateBeforeEvent(ctx context.Context, roomVer gomatr
FedClient: b.fsAPI,
RememberAuthEvents: false,
Server: srv,
+ Origin: b.virtualHost,
}
result, err := c.StateBeforeEvent(ctx, roomVer, event, eventIDs)
if err != nil {