The enhancement
The Need
In #10155, Octopus Server gained an HTTP rate limiter, which rejects requests with an HTTP 429 (TooManyRequests) error if a client issues them too rapidly.
The Octopus C# Client did not understand these requests, and would simply propagate an HTTP 429 by throwing an OctopusException
Solution
Octopus C# client version 22.9.2886 introduces support for rate limiting.
When the Octopus Server rejects a request with a 429, the client will now wait the duration specified in the Retry-After HTTP response header, then try again. The user of the client is not affected, they will not experience any exceptions or failures, just the delay.
Configuration:
The OctopusClientOptions object gains three new options:
RateLimitRetryCount - an integer number, defaulting to 3 which specifies how many times the client will retry an HTTP 429 before giving up.
- Set this to
0 to disable the client's retry behavior
RateLimitRetryDefaultDelay - TimeSpan, defaulting to 2 seconds which specifies how long the client should wait if it sees an HTTP 429 without a Retry-After header. The server should always set a header, this is just a defense-in-depth mechanism
RateLimitRetryMaxDelay - TimeSpan, defaulting to 30 seconds, which is a safety net against unexpected server responses. If the server's Retry-After header tells the client to wait more than this length of time, the client will throw the OctopusException rather than waiting for an unreasonable amount of time. The server should not send invalid responses, this is just a defense-in-depth mechanism.
Edge case
- Requests which stream content (e.g. file uploads) cannot be safely retried by the client. If the server sends a 429 in response to one, the exception will be thrown immediately.
Links
https://octopus.com/docs/administration/managing-infrastructure/rate-limiting/
The enhancement
The Need
In #10155, Octopus Server gained an HTTP rate limiter, which rejects requests with an HTTP 429 (TooManyRequests) error if a client issues them too rapidly.
The Octopus C# Client did not understand these requests, and would simply propagate an HTTP 429 by throwing an
OctopusExceptionSolution
Octopus C# client version 22.9.2886 introduces support for rate limiting.
When the Octopus Server rejects a request with a 429, the client will now wait the duration specified in the
Retry-AfterHTTP response header, then try again. The user of the client is not affected, they will not experience any exceptions or failures, just the delay.Configuration:
The
OctopusClientOptionsobject gains three new options:RateLimitRetryCount- an integer number, defaulting to3which specifies how many times the client will retry an HTTP 429 before giving up.0to disable the client's retry behaviorRateLimitRetryDefaultDelay- TimeSpan, defaulting to 2 seconds which specifies how long the client should wait if it sees an HTTP 429 without aRetry-Afterheader. The server should always set a header, this is just a defense-in-depth mechanismRateLimitRetryMaxDelay- TimeSpan, defaulting to 30 seconds, which is a safety net against unexpected server responses. If the server'sRetry-Afterheader tells the client to wait more than this length of time, the client will throw theOctopusExceptionrather than waiting for an unreasonable amount of time. The server should not send invalid responses, this is just a defense-in-depth mechanism.Edge case
Links
https://octopus.com/docs/administration/managing-infrastructure/rate-limiting/