fix: if we dont get a 200, increase the retry count to prevent a possible infinite loop
This commit is contained in:
parent
e2d79c0357
commit
5fcf99d97e
|
@ -286,6 +286,10 @@ func (s *StorageService) DownloadBytesByHash(hash *encoding.Multihash) ([]byte,
|
||||||
|
|
||||||
if res.StatusCode != 200 {
|
if res.StatusCode != 200 {
|
||||||
err := dlUriProvider.Downvote(dlUri)
|
err := dlUriProvider.Downvote(dlUri)
|
||||||
|
retryCount++
|
||||||
|
if retryCount > 32 {
|
||||||
|
return nil, errors.New("too many retries")
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue