Skip to content

Commit 3639bee

Browse files
Use RetryReader when reading from Azure
1 parent 16f17d8 commit 3639bee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pbm/storage/azure/azure.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,14 @@ func (b *Blob) SourceReader(name string) (io.ReadCloser, error) {
302302
return nil, errors.Wrap(err, "download object")
303303
}
304304

305-
return o.Body, nil
305+
rr := o.NewRetryReader(context.TODO(), &azblob.RetryReaderOptions{
306+
EarlyCloseAsError: true,
307+
OnFailedRead: func(failureCount int32, lastError error, rnge azblob.HTTPRange, willRetry bool) {
308+
// failureCount is reset on each call to Read(), so repeats of "attempt 1" are expected
309+
b.log.Debug("Read from Azure failed (attempt %d): %v, retrying: %v\n", failureCount, lastError, willRetry)
310+
},
311+
})
312+
return rr, nil
306313
}
307314

308315
func (b *Blob) Delete(name string) error {

0 commit comments

Comments
 (0)