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

fix: Reset the retry counter to 0 when receiving data #1604

Merged
merged 22 commits into from
May 27, 2024

Conversation

danieljbruce
Copy link
Contributor

Source code changes

A handler for data is added along with a line of code that sets the retry counter to 0 when data is received. This ensures that the max retries limit is only reached if enough consecutive retriable errors are encountered without any data being received between those errors. This is being introduced to match current nodejs-bigtable retry behaviour where a counter is reset that interacts with the maxRetries parameters for custom retries.

Test Application changes

A test is added that emits 4 retryable errors from a server while also emitting data between each error. Since max retries is set in this test to 2 then the test ensures that the retry count is actually being reset because the test only passes if none of the retryable errors result in the max retries limit being reached.

Unit Test changes

An existing test pushes data between retries, but expects an error to be thrown when the number of retries exceeds the max retries value of 2. We no longer want this behaviour because if data is being emitted between retries then an error saying the max retries has been exceeded should not get emitted. Therefore, we change the test so that it doesn't emit data in which case we should see the max retries exceeded error making the test validate client library behaviour that we expect.

@danieljbruce danieljbruce requested review from a team as code owners May 22, 2024 14:47
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label May 22, 2024
@danieljbruce danieljbruce changed the title fix: Prepare reset counter to 0 pr fix fix: Reset the retry counter to 0 when receiving data May 22, 2024
@leahecole leahecole self-assigned this May 22, 2024
Copy link
Contributor

@leahecole leahecole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change request

gax/src/streamingCalls/streaming.ts Outdated Show resolved Hide resolved
gax/test/test-application/src/index.ts Show resolved Hide resolved
gax/test/test-application/src/index.ts Show resolved Hide resolved
danieljbruce and others added 2 commits May 23, 2024 14:11
Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants