question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calculating sleep duration for WaitAndRetry, based on the execution result; eg 429 headers

See original GitHub issue

Hi,

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:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tcsatheeshcommented, Feb 28, 2017

+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.

1reaction
reisenbergercommented, Jan 15, 2017

@johnmcase @jmansar This is added to the roadmap, in the generalized/extensible way I propose we should take this forward.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Polly
Pow(2, retryAttempt))); // Retry a specified number of times, using a function to // calculate the duration to wait between retries based on...
Read more >
Implementing 429 retries and throttling for API rate-limits - Anvil
If you exceed an API provider's rate-limit, their server should respond with a 429 status code ( Too Many Requests ) and a...
Read more >
Release Notes for Arq Backup Version 5.22
Changed next backup time calculation for daily backups so that it's at ... a 429 (rate-limiting) error during backup, sleep and try again....
Read more >
3730 check-ins using file src/auth.c version f4fa91b6
SSS (2) Add the timediff(A,B) SQL function that returns the time-shift modifier sufficient to move B to A. (check-in: 574bf370 user: drh tags:...
Read more >
How to avoid HTTP error 429 (Too Many Requests) python
The proper way to deal with this "problem" is to read this header and to sleep your process for that many seconds.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found