this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

always just fetch repos from the pds in backfill (#939)

authored by

Whyrusleeping and committed by
GitHub
3ba790dc ae849136

+14 -6
+14 -6
backfill/backfill.go
··· 82 82 magicHeaderKey string 83 83 magicHeaderVal string 84 84 85 + tryRelayRepoFetch bool 86 + 85 87 stop chan chan struct{} 86 88 87 89 Directory identity.Directory ··· 376 378 } 377 379 log.Info(fmt.Sprintf("processing backfill for %s", repoDID)) 378 380 379 - // first try with Relay endpoint 380 - r, err := b.fetchRepo(ctx, repoDID, job.Rev(), b.RelayHost) 381 - if err != nil { 382 - slog.Warn("repo CAR fetch from relay failed", "did", repoDID, "since", job.Rev(), "relayHost", b.RelayHost, "err", err) 383 - // fallback to direct PDS fetch 381 + var r *repo.Repo 382 + if b.tryRelayRepoFetch { 383 + rr, err := b.fetchRepo(ctx, repoDID, job.Rev(), b.RelayHost) 384 + if err != nil { 385 + slog.Warn("repo CAR fetch from relay failed", "did", repoDID, "since", job.Rev(), "relayHost", b.RelayHost, "err", err) 386 + } else { 387 + r = rr 388 + } 389 + } 390 + 391 + if r == nil { 384 392 ident, err := b.Directory.LookupDID(ctx, syntax.DID(repoDID)) 385 393 if err != nil { 386 394 return "failed resolving DID to PDS repo", fmt.Errorf("resolving DID for PDS repo fetch: %w", err) ··· 389 397 if pdsHost == "" { 390 398 return "DID document missing PDS endpoint", fmt.Errorf("no PDS endpoint for DID: %s", repoDID) 391 399 } 400 + 392 401 r, err = b.fetchRepo(ctx, repoDID, job.Rev(), pdsHost) 393 402 if err != nil { 394 403 slog.Warn("repo CAR fetch from PDS failed", "did", repoDID, "since", job.Rev(), "pdsHost", pdsHost, "err", err) 395 404 return "repo CAR fetch from PDS failed", err 396 405 } 397 - slog.Info("repo CAR fetch from PDS successful", "did", repoDID, "since", job.Rev(), "pdsHost", pdsHost, "err", err) 398 406 } 399 407 400 408 numRecords := 0