fix: if we dont get a 200, increase the retry count to prevent a possible infinite loop

This commit is contained in:
Derrick Hammer 2024-03-05 13:11:56 -05:00
parent e2d79c0357
commit 5fcf99d97e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 0 deletions

View File

@ -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
} }