Skip to content
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

Merged
merged 7 commits into from
Sep 16, 2024

Conversation

bshaffer
Copy link
Contributor

... also, ensure the exponential delay is reset when we receive a successful row

@bshaffer bshaffer requested review from a team as code owners September 10, 2024 23:07
@bshaffer bshaffer force-pushed the add-retry-delay-for-bigtable-resumable-stream branch from e62b520 to 01629bc Compare September 11, 2024 13:29
Bigtable/src/ResumableStream.php Outdated Show resolved Hide resolved
Bigtable/src/ResumableStream.php Show resolved Hide resolved
@@ -116,6 +121,17 @@ public function __construct(
$this->callOptions['retrySettings'] = [
'retriesEnabled' => false
];

$this->delayFunction = function (int $backoffCount) {

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?

Copy link
Contributor Author

@bshaffer bshaffer Sep 11, 2024

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

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(

Copy link
Contributor Author

@bshaffer bshaffer Sep 11, 2024

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.

Bigtable/src/ResumableStream.php Outdated Show resolved Hide resolved
@bshaffer bshaffer merged commit c252123 into main Sep 16, 2024
25 checks passed
@bshaffer bshaffer deleted the add-retry-delay-for-bigtable-resumable-stream branch September 16, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants