Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit 2e1fe58

Browse files
authored
Fix backfilling (#2926)
This should fix #2923
1 parent e449d17 commit 2e1fe58

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
2323
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
2424
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
25-
github.com/matrix-org/gomatrixserverlib v0.0.0-20221129095800-8835f6db16b8
25+
github.com/matrix-org/gomatrixserverlib v0.0.0-20230105074811-965b10ae73ab
2626
github.com/matrix-org/pinecone v0.0.0-20221118192051-fef26631b847
2727
github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4
2828
github.com/mattn/go-sqlite3 v1.14.15

Diff for: go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw
348348
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
349349
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
350350
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
351-
github.com/matrix-org/gomatrixserverlib v0.0.0-20221129095800-8835f6db16b8 h1:jVvlCGs6OosCdvw9MkfiVnTVnIt7vKMHg/F6th9BtSo=
352-
github.com/matrix-org/gomatrixserverlib v0.0.0-20221129095800-8835f6db16b8/go.mod h1:Mtifyr8q8htcBeugvlDnkBcNUy5LO8OzUoplAf1+mb4=
351+
github.com/matrix-org/gomatrixserverlib v0.0.0-20230105074811-965b10ae73ab h1:ChaQdT2mpxMm3GRXNOZzLDQ/wOnlKZ8o60LmZGOjdj8=
352+
github.com/matrix-org/gomatrixserverlib v0.0.0-20230105074811-965b10ae73ab/go.mod h1:Mtifyr8q8htcBeugvlDnkBcNUy5LO8OzUoplAf1+mb4=
353353
github.com/matrix-org/pinecone v0.0.0-20221118192051-fef26631b847 h1:auIBCi7gfZuvztD0aPr1G/J5Ya5vWr79M/+TJqwD/JM=
354354
github.com/matrix-org/pinecone v0.0.0-20221118192051-fef26631b847/go.mod h1:F3GHppRuHCTDeoOmmgjZMeJdbql91+RSGGsATWfC7oc=
355355
github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4 h1:eCEHXWDv9Rm335MSuB49mFUK44bwZPFSDde3ORE3syk=

Diff for: roomserver/internal/perform/perform_backfill.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,14 @@ func (r *Backfiller) backfillViaFederation(ctx context.Context, req *api.Perform
122122
ctx, req.VirtualHost, requester,
123123
r.KeyRing, req.RoomID, info.RoomVersion, req.PrevEventIDs(), 100,
124124
)
125-
if err != nil {
125+
// Only return an error if we really couldn't get any events.
126+
if err != nil && len(events) == 0 {
126127
logrus.WithError(err).Errorf("gomatrixserverlib.RequestBackfill failed")
127128
return err
128129
}
129-
logrus.WithField("room_id", req.RoomID).Infof("backfilled %d events", len(events))
130+
// If we got an error but still got events, that's fine, because a server might have returned a 404 (or something)
131+
// but other servers could provide the missing event.
132+
logrus.WithError(err).WithField("room_id", req.RoomID).Infof("backfilled %d events", len(events))
130133

131134
// persist these new events - auth checks have already been done
132135
roomNID, backfilledEventMap := persistEvents(ctx, r.DB, events)
@@ -319,6 +322,7 @@ FederationHit:
319322
FedClient: b.fsAPI,
320323
RememberAuthEvents: false,
321324
Server: srv,
325+
Origin: b.virtualHost,
322326
}
323327
res, err := c.StateIDsBeforeEvent(ctx, targetEvent)
324328
if err != nil {
@@ -394,6 +398,7 @@ func (b *backfillRequester) StateBeforeEvent(ctx context.Context, roomVer gomatr
394398
FedClient: b.fsAPI,
395399
RememberAuthEvents: false,
396400
Server: srv,
401+
Origin: b.virtualHost,
397402
}
398403
result, err := c.StateBeforeEvent(ctx, roomVer, event, eventIDs)
399404
if err != nil {

0 commit comments

Comments
 (0)