@@ -5,7 +5,10 @@ import (
5
5
"context"
6
6
"encoding/json"
7
7
"io"
8
+ "time"
8
9
10
+ "github.com/Azure/azure-sdk-for-go/sdk/azcore"
11
+ "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
9
12
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
10
13
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob"
11
14
"github.com/pkg/errors"
@@ -45,8 +48,18 @@ func (c *Cache) reserveV2(ctx context.Context, key string) (string, error) {
45
48
return cr .SignedUploadURL , nil
46
49
}
47
50
51
+ var azureOptions = & blockblob.ClientOptions {
52
+ ClientOptions : azcore.ClientOptions {
53
+ Retry : policy.RetryOptions {
54
+ MaxRetries : 10 ,
55
+ MaxRetryDelay : 2 * time .Minute ,
56
+ RetryDelay : 10 * time .Second ,
57
+ },
58
+ },
59
+ }
60
+
48
61
func (c * Cache ) uploadV2 (ctx context.Context , url string , b Blob ) error {
49
- client , err := blockblob .NewClientWithNoCredential (url , nil )
62
+ client , err := blockblob .NewClientWithNoCredential (url , azureOptions )
50
63
if err != nil {
51
64
return errors .WithStack (err )
52
65
}
@@ -62,7 +75,7 @@ func (c *Cache) uploadV2(ctx context.Context, url string, b Blob) error {
62
75
63
76
func (ce * Entry ) downloadV2 (ctx context.Context ) ReaderAtCloser {
64
77
return toReaderAtCloser (func (offset int64 ) (io.ReadCloser , error ) {
65
- client , err := blockblob .NewClientWithNoCredential (ce .URL , nil )
78
+ client , err := blockblob .NewClientWithNoCredential (ce .URL , azureOptions )
66
79
if err != nil {
67
80
return nil , errors .WithStack (err )
68
81
}
0 commit comments