Skip to content

Commit

Permalink
Merge pull request #73 Add shortcuts to set DefaultClient's retry tim…
Browse files Browse the repository at this point in the history
…eouts
  • Loading branch information
jeevatkm authored Jun 16, 2017
2 parents 7a8134d + 1352d1a commit f709999
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ func TestClientOptions(t *testing.T) {

SetRetryCount(3)
assertEqual(t, 3, DefaultClient.RetryCount)

rwt := time.Duration(1000) * time.Millisecond
SetRetryWaitTime(rwt)
assertEqual(t, rwt, DefaultClient.RetryWaitTime)

mrwt := time.Duration(2) * time.Second
SetRetryMaxWaitTime(mrwt)
assertEqual(t, mrwt, DefaultClient.RetryMaxWaitTime)

err := &AuthError{}
SetError(err)
Expand Down
12 changes: 11 additions & 1 deletion default.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,21 @@ func SetDebug(d bool) *Client {
return DefaultClient.SetDebug(d)
}

// SetRetryCount method set the retry count. See `Client.SetRetryCount` for more information.
// SetRetryCount method sets the retry count. See `Client.SetRetryCount` for more information.
func SetRetryCount(count int) *Client {
return DefaultClient.SetRetryCount(count)
}

// SetRetryWaitTime method sets the retry wait time. See `Client.SetRetryWaitTime` for more information.
func SetRetryWaitTime(waitTime time.Duration) *Client {
return DefaultClient.SetRetryWaitTime(waitTime)
}

// SetRetryMaxWaitTime method sets the retry max wait time. See `Client.SetRetryMaxWaitTime` for more information.
func SetRetryMaxWaitTime(maxWaitTime time.Duration) *Client {
return DefaultClient.SetRetryMaxWaitTime(maxWaitTime)
}

// AddRetryCondition method appends check function for retry. See `Client.AddRetryCondition` for more information.
func AddRetryCondition(condition RetryConditionFunc) *Client {
return DefaultClient.AddRetryCondition(condition)
Expand Down

0 comments on commit f709999

Please sign in to comment.