Conversation
|
|
||
| func NewRetryAPIClient() *http.Client { | ||
| var retryClient = retryablehttp.NewClient() | ||
| retryClient.Backoff = thousandEyesBackoff |
There was a problem hiding this comment.
I don't set up RetryMax so the client will attempt 5 times as the default.
| ) | ||
|
|
||
| // Custom backoff function | ||
| func thousandEyesBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration { |
There was a problem hiding this comment.
This function has the same logic as the python SDK which respects Retry-After first then checks thousandeyes headers. https://github.com/thousandeyes/thousandeyes-sdk-python/pull/7/files#diff-8587054108c7902eac148f3b9ea7a213f04ddebde0be29f8b68affe61b98b39fR46
There was a problem hiding this comment.
its ok to have ur branch with the internal ticket number, but the PR name shouldnt contain it.
prefix it with feature: since its a new feature included
Also, do you mind testing this with the terraform provider before we proceed with actually merging/tagging, etc?
|
@phpinhei-te Tested it locally: thousandeyes/terraform-provider-thousandeyes#265 (comment) |
Reference: https://github.com/thousandeyes/thousandeyes-sdk-python/pull/7/files
Test locally by sending over 200 requests at the same time, which received 429s when reaching the rate limit without the change. All requests received 200 after the change was applied:

Locally terraform provider applied thousandeyes resources successfully waiting for rate limit to be reset:
Before
After