Closed johnbatty closed 8 months ago
@reillysiemens This may be of interest, given your comments in https://github.com/Azure/azure-sdk-for-rust/pull/1510
This obviously doesn't do anything to support the additional Azure DevOps throttling headers that you wanted to add (which are more about monitoring/controlling request rate to avoid hitting server throttling), but does at least provide appropriate throttling delays and retries when the server returns TooManyRequests
. Once this change is in azure_core
, it will get picked up by the next release of azure-devops-rust-api
.
Fixes: https://github.com/Azure/azure-sdk-for-rust/issues/1516
Updated
azure_core
retry policy to implement throttling by looking for and using the values returned by a server viaretry-after
,retry-after-ms
orx-ms-retry-after-ms
headers when the server returns 429 (TooManyRequests
) or 503 (ServerUnavailable
).Details:
retry-after
headers inlro.rs
(long-running operations).retry_policies
module, as I felt this was probably a more appropriate home for it.<xxx>-ms
headers before theretry-after
header.RetryPolicy
traitwait(...)
method to have an additionalretry_after
parameter, to enable passing in of retry-after duration extracted from the headers (if any):retry-after
header value when the server response is 429 or 503. Then when calculating the sleep time for any retry policy in thewait(...)
method it takes the maximum of the retry-after value (if any) and the calculated policy value.