@cryptotaxi247 / kubo / commits / 4f3eb4cdd

feat: log multifetcher errors

This is to make it easier to understand why the multifetcher is falling back to a different fetcher.

Gus Eggert committed Feb 10, 2022 at 17:48 UTC 4f3eb4cdd4bc8d7dcec54a37e7f888cce7c01cc9
1 file changed +4 -1
repo/fsrepo/migrations/fetcher.go
+4 -1
@@ -2,6 +2,7 @@ package migrations
2
3 import (
4 "context"
5 + "fmt"
6 "io"
7 "os"
8
@@ -39,7 +40,8 @@ type limitReadCloser struct {
40
41 // NewMultiFetcher creates a MultiFetcher with the given Fetchers. The
42 // Fetchers are tried in order ther passed to this function.
42 -func NewMultiFetcher(f ...Fetcher) Fetcher {
43 +func NewMultiFetcher(f ...Fetcher) *MultiFetcher {
44 +
45 mf := &MultiFetcher{
46 fetchers: make([]Fetcher, len(f)),
47 }
@@ -56,6 +58,7 @@ func (f *MultiFetcher) Fetch(ctx context.Context, ipfsPath string) (io.ReadClose
58 if err == nil {
59 return rc, nil
60 }
61 + fmt.Printf("Error fetching: %s\n", err.Error())
62 errs = multierror.Append(errs, err)
63 }
64 return nil, errs