-
Notifications
You must be signed in to change notification settings - Fork 436
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
feat: add exponential backoff to ResumableStream #7664
Conversation
e62b520
to
01629bc
Compare
Bigtable/src/ResumableStream.php
Outdated
@@ -116,6 +121,17 @@ public function __construct( | |||
$this->callOptions['retrySettings'] = [ | |||
'retriesEnabled' => false | |||
]; | |||
|
|||
$this->delayFunction = function (int $backoffCount) { |
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.
why does this need to be closure?
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.
It's a closure so that we can test its accuracy in the test (see this line).
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 think it would be better to use the mock framework to create a spy for this method:
prophesize(
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.
AFAIK, It's not possible to do what you're asking with Prophecy.
You're asking to mock a method in ResumableStream
, but we are not mocking the ResumableStream
class, and partial mocks are not supported in Prophecy.
... also, ensure the exponential delay is reset when we receive a successful row