-
-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Add capabilities to handle Retry-After headers and similar info from server Motivation: some servers provide Retry-After header or similar info along with 429 or 503 status code, and it is often important to honor such information on retries, i.e. simple expotential backoff is not optimal. https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online 2) Add option NOT to retry even if operation returns an error (but retry by default, if no retry conditions are set) Motivation: error are already passed to condition callback in resty, but Backoff() still retries the request if error is not nil. It implies excessive, stillborn retries for non-retryble errors from underlying http client (i.e. with RoundTripper from oauth2). 3) Remove error return value from condition callback Motivation: this error is neither passed to caller, nor logged in any way. It is cleaner to have "needRetry == true" than "needRetry == true || conditionErr != nil". 4) Does not use floating-point arithmetics for expotential backoff Motivation: simplification & performance
- Loading branch information
1 parent
46fc51a
commit e5f377d
Showing
4 changed files
with
376 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.