-
Notifications
You must be signed in to change notification settings - Fork 53
RFC: update retry plugin backoff default to be more sensible #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: update retry plugin backoff default to be more sensible #86
Conversation
The documentation for the constructor says: /**
* @var callable $delay A callback that gets a request, an exception and the number of retries
* and returns how many milliseconds we should wait before trying again.
*/ So the callable should return milliseconds. But we use in in |
Yep, good point. What do you think of my proposed default delay now? |
I think the backoff times are more reasonable. But it would not hurt to multiply them (yours) with 5 or maybe 10. =) |
* 5
* 10
|
No, sorry, I meant x500 or x1000. |
Sure, the the relays would get very long quite quickly though:
|
Yeah, but doing more than 5 will rarely be necessary. |
Could you make these updates to the PR? Both better defaults and the doc/multiply thing discussed? |
28ca08c
to
5c58e4f
Compare
@Nyholm updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. Dont forget to update the tests.
src/Plugin/RetryPlugin.php
Outdated
@@ -117,6 +117,6 @@ public function handleRequest(RequestInterface $request, callable $next, callabl | |||
*/ | |||
public static function defaultDelay(RequestInterface $request, Exception $e, $retries) | |||
{ | |||
return pow(2, $retries) * 1000; | |||
return pow(2, $retries) * 1000 * 500; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets precalculate this. Write 500000 instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually did this intentionally so it's more obvious what we are doing, but happy to oblige .
5c58e4f
to
f1990f9
Compare
spec updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
As discussed in #79, the default delay function is not very delaying at all. With 10 retries, the delays (in seconds) of the old impl are:
I've simply multiplied by 100 here, so the new delays are:
Open to other suggests for a better delay.