Skip to content

Commit e11316d

Browse files
authored
Merge pull request #1177 from ripjar/LS-20087
PBM-1593 Use RetryReader when reading from Azure
2 parents f5fcc1f + d2a5ed6 commit e11316d

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
@@ -324,7 +324,14 @@ func (b *Blob) SourceReader(name string) (io.ReadCloser, error) {
324324
return nil, errors.Wrap(err, "download object")
325325
}
326326

327-
return o.Body, nil
327+
rr := o.NewRetryReader(context.TODO(), &azblob.RetryReaderOptions{
328+
EarlyCloseAsError: true,
329+
OnFailedRead: func(failureCount int32, lastError error, rnge azblob.HTTPRange, willRetry bool) {
330+
// failureCount is reset on each call to Read(), so repeats of "attempt 1" are expected
331+
b.log.Debug("Read from Azure failed (attempt %d): %v, retrying: %v", failureCount, lastError, willRetry)
332+
},
333+
})
334+
return rr, nil
328335
}
329336

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

0 commit comments

Comments
 (0)