From 418bc6e709b2fc86bb6b2dee264aea013d5bdce7 Mon Sep 17 00:00:00 2001 From: Gus Eggert Date: Thu, 10 Feb 2022 17:48:38 -0500 Subject: [PATCH] feat: log multifetcher errors This is to make it easier to understand why the multifetcher is falling back to a different fetcher. (cherry picked from commit 4f3eb4cdd4bc8d7dcec54a37e7f888cce7c01cc9) --- repo/fsrepo/migrations/fetcher.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repo/fsrepo/migrations/fetcher.go b/repo/fsrepo/migrations/fetcher.go index 26a9275de..06794236e 100644 --- a/repo/fsrepo/migrations/fetcher.go +++ b/repo/fsrepo/migrations/fetcher.go @@ -2,6 +2,7 @@ package migrations import ( "context" + "fmt" "io" "os" @@ -39,7 +40,8 @@ type limitReadCloser struct { // NewMultiFetcher creates a MultiFetcher with the given Fetchers. The // Fetchers are tried in order ther passed to this function. -func NewMultiFetcher(f ...Fetcher) Fetcher { +func NewMultiFetcher(f ...Fetcher) *MultiFetcher { + mf := &MultiFetcher{ fetchers: make([]Fetcher, len(f)), } @@ -56,6 +58,7 @@ func (f *MultiFetcher) Fetch(ctx context.Context, ipfsPath string) (io.ReadClose if err == nil { return rc, nil } + fmt.Printf("Error fetching: %s\n", err.Error()) errs = multierror.Append(errs, err) } return nil, errs