Implement Request Retry and Backoff (#491)

Refactoring the timeout retries into a more general 'retry policy' with
 support for retrying on HTTP 429 (Too Many Requests) and other responses
 with a `Retry-After` header

The delay between requests is controlled by a combination of a 'backoff'
 (currently only a simple linear backoff), and honouring the
 `Retry-After` value (longest delay wins)

This makes the 'rate limiter' an optional argument as well, removing the
 use of `nil` when one isn't supplied

Signed-off-by: David Ackroyd <daveo.ackroyd@gmail.com>
This commit is contained in:
David Ackroyd
2020-05-05 13:12:29 +10:00
committed by GitHub
parent 70615279bd
commit 56e535001c
80 changed files with 791 additions and 250 deletions

View File

@@ -59,7 +59,7 @@ type Settings struct {
EnableExchangeRESTSupport bool
EnableExchangeWebsocketSupport bool
MaxHTTPRequestJobsLimit int
RequestTimeoutRetryAttempts int
RequestMaxRetryAttempts int
// Global HTTP related settings
GlobalHTTPTimeout time.Duration
@@ -67,9 +67,9 @@ type Settings struct {
GlobalHTTPProxy string
// Exchange HTTP related settings
ExchangeHTTPTimeout time.Duration
ExchangeHTTPUserAgent string
ExchangeHTTPProxy string
HTTPTimeout time.Duration
HTTPUserAgent string
HTTPProxy string
// Dispatch system settings
EnableDispatcher bool