Calculating sleep duration for WaitAndRetry, based on the execution result; eg 429 headers
See original GitHub issueHi,
I have a small enhancement idea.
Currently the sleepDurationProvider
function in the RetryWithSleep
policy doesn’t have access to the result of the executed action. The only value passed to the sleepDurationProvider
is the retry count.
I have a scenario where it would be quite useful to know the result in the wait time calculation function.
Scenario
There is an API, which I call in my application. It returns the error response with the Retry-After
HTTP header set, when client exceeds the request rate limit or it is temporarily unavailable.
The header contains number of seconds the client should wait before repeating the request.
It should be possible to use that value as a wait time.
Could you extend the sleepDurationProvider function to include the result from the executed action?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
+1 My scenario: When querying DocumentDb if the request rate is too high the error response from the server includes a RetryAfter which is the Timespan to wait before retrying. It would be helpful if I can use this as part of my Retry policy.
@johnmcase @jmansar This is added to the roadmap, in the generalized/extensible way I propose we should take this forward.