-
Notifications
You must be signed in to change notification settings - Fork 93
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: Counter does increment first retry #1601
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also move resolve up
Retries parameter needs to change
cc @sofisl just for visibility 🙂 |
leahecole
requested changes
May 21, 2024
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.
One small change!
Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
…om/googleapis/gax-nodejs into counter-does-increment-first-retry
leahecole
approved these changes
May 22, 2024
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.
🥳
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Source code changes
One line of code is added to increment the retry counter for the first error that is encountered as that is not currently done.
Test application code changes
A test called
testShouldFailOnThirdError
is added that sends three retriable errors from the server and then sends an OK status code with some data. On the third error, sincemaxRetries
is set to 2, an error should bubble up to the test application that says the maximum number of retries have been exceeded. The test ensures that this error does in fact bubble up and get received by the user.The source code change breaks test
testServerStreamingRetrieswithRetryRequestOptions
, but this test should not be passing as is. In this test, maxRetries in streaming.ts gets set to 1, but the server in this test emits 2 errors so an error should bubble up to the test application. The test however, expects no error to bubble up so this test is changed so that maxRetries does not get set to 1.Unit test change
One of the existing unit tests expects the retry function to be called 3 times. The logic in the comment mentions that
even though max retries is 2 the retry function will always be called maxRetries+1 the final call is where the failure happens
. But note that on the final error, retry never actually gets called so really we should be only expecting retry to be called twice in the test.This unit test is also wrapped with a try/catch block so that when the assert statements fail, mocha reports a failing test with the error instead of timing out.