diff --git a/storage.go b/storage.go index 2916cd6..1038f1c 100644 --- a/storage.go +++ b/storage.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "math/rand" "net/http" storageTypes "github.com/jackalLabs/canine-chain/x/storage/types" @@ -55,6 +56,10 @@ func downloadFile(qc storageTypes.QueryClient, fid string, writer io.Writer) err fmt.Println("attempting to download file...") + rand.Shuffle(len(arr), func(i, j int) { // randomize provider order + arr[i], arr[j] = arr[j], arr[i] + }) + failed := true for _, s := range arr { err := downloadFileFromURL(s, fid, writer)