Skip to content

Commit

Permalink
Replacing WithMaxRetry to WithMaxAttempts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tulsishah committed Jan 5, 2024
1 parent 303b8e8 commit fbb30ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions storage/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ func TestBucketRetryer(t *testing.T) {
Multiplier: 3,
}),
WithPolicy(RetryAlways),
WithMaxRetry(5),
WithMaxAttempts(5),
WithErrorFunc(func(err error) bool { return false }))
},
want: &retryConfig{
Expand Down Expand Up @@ -1110,7 +1110,7 @@ func TestBucketRetryer(t *testing.T) {
{
name: "set max retry count only",
call: func(b *BucketHandle) *BucketHandle {
return b.Retryer(WithMaxRetry(5))
return b.Retryer(WithMaxAttempts(5))
},
want: &retryConfig{
maxRetryCount: 5,
Expand Down
4 changes: 2 additions & 2 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2076,8 +2076,8 @@ func (wb *withBackoff) apply(config *retryConfig) {
config.backoff = &wb.backoff
}

// WithMaxRetry sets the maximum number of retries for operations that may fail.
func WithMaxRetry(maxRetryCount int) RetryOption {
// WithMaxAttempts sets the maximum number of retries for operations that may fail.
func WithMaxAttempts(maxRetryCount int) RetryOption {
return &withMaxRetry{
maxRetryCount: maxRetryCount,
}
Expand Down
22 changes: 11 additions & 11 deletions storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ func TestObjectRetryer(t *testing.T) {
Max: 30 * time.Second,
Multiplier: 3,
}),
WithMaxRetry(5),
WithMaxAttempts(5),
WithPolicy(RetryAlways),
WithErrorFunc(func(err error) bool { return false }))
},
Expand Down Expand Up @@ -1017,7 +1017,7 @@ func TestObjectRetryer(t *testing.T) {
{
name: "set max retry count only",
call: func(o *ObjectHandle) *ObjectHandle {
return o.Retryer(WithMaxRetry(11))
return o.Retryer(WithMaxAttempts(11))
},
want: &retryConfig{
maxRetryCount: 11,
Expand Down Expand Up @@ -1074,7 +1074,7 @@ func TestClientSetRetry(t *testing.T) {
Max: 30 * time.Second,
Multiplier: 3,
}),
WithMaxRetry(5),
WithMaxAttempts(5),
WithPolicy(RetryAlways),
WithErrorFunc(func(err error) bool { return false }),
},
Expand Down Expand Up @@ -1113,7 +1113,7 @@ func TestClientSetRetry(t *testing.T) {
{
name: "set max retry count only",
clientOptions: []RetryOption{
WithMaxRetry(7),
WithMaxAttempts(7),
},
want: &retryConfig{
maxRetryCount: 7,
Expand Down Expand Up @@ -1172,7 +1172,7 @@ func TestRetryer(t *testing.T) {
name: "object retryer configures retry",
objectOptions: []RetryOption{
WithPolicy(RetryAlways),
WithMaxRetry(5),
WithMaxAttempts(5),
WithErrorFunc(ShouldRetry),
},
want: &retryConfig{
Expand All @@ -1190,7 +1190,7 @@ func TestRetryer(t *testing.T) {
Multiplier: 6,
}),
WithPolicy(RetryAlways),
WithMaxRetry(11),
WithMaxAttempts(11),
WithErrorFunc(ShouldRetry),
},
want: &retryConfig{
Expand All @@ -1213,7 +1213,7 @@ func TestRetryer(t *testing.T) {
Multiplier: 6,
}),
WithPolicy(RetryAlways),
WithMaxRetry(7),
WithMaxAttempts(7),
WithErrorFunc(ShouldRetry),
},
want: &retryConfig{
Expand All @@ -1234,7 +1234,7 @@ func TestRetryer(t *testing.T) {
},
objectOptions: []RetryOption{
WithPolicy(RetryNever),
WithMaxRetry(5),
WithMaxAttempts(5),
WithErrorFunc(ShouldRetry),
},
want: &retryConfig{
Expand All @@ -1250,7 +1250,7 @@ func TestRetryer(t *testing.T) {
},
objectOptions: []RetryOption{
WithPolicy(RetryNever),
WithMaxRetry(11),
WithMaxAttempts(11),
WithErrorFunc(ShouldRetry),
},
want: &retryConfig{
Expand All @@ -1275,7 +1275,7 @@ func TestRetryer(t *testing.T) {
Max: time.Microsecond,
}),
WithErrorFunc(ShouldRetry),
WithMaxRetry(5),
WithMaxAttempts(5),
},
want: &retryConfig{
policy: RetryAlways,
Expand Down Expand Up @@ -1314,7 +1314,7 @@ func TestRetryer(t *testing.T) {
bucketOptions: []RetryOption{
WithPolicy(RetryNever),
WithErrorFunc(ShouldRetry),
WithMaxRetry(5),
WithMaxAttempts(5),
},
objectOptions: []RetryOption{
WithBackoff(gax.Backoff{
Expand Down

0 comments on commit fbb30ff

Please sign in to comment.