-
Notifications
You must be signed in to change notification settings - Fork 94
fix: Only call getResumptionRequestFn once #1593
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: Only call getResumptionRequestFn once #1593
Conversation
The current code calls getResumptionRequestFn twice when the result from the first call can be reused. For clients implementing retries, we only want one call to getResumptionRequestFn to be done per request because we don’t want the state that getResumptionRequestFn relies on to be modified twice.
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
…jbruce/gax-nodejs into only-call-resumption-once
Upon further inspection of this, it looks like the state updates need to be done earlier in the |
If tests are passing, this seems good to me, but I think we should get #1592 merged first just to make sure there's no unexpected side effects of it |
Teat failures likely not related to this PR. Will try rerunning in a bit |
I think this does have value and when I was going through the code, I honestly think that the original way this was written was likely a mistake because we don't utilize the |
Source code changes
The current code calls
getResumptionRequestFn
twice when the result from the first call can be reused. For clients implementing retries, we only want one call togetResumptionRequestFn
to be done per request because we don’t want the state thatgetResumptionRequestFn
relies on to be modified twice.This change intends to reuse the result from the first call to
getResumptionRequestFn
so thatgetResumptionRequestFn
is only called once.Test changes
The resumption function is wrapped in sinon.spy so that its call count can be measured in an existing test. The call count is later tested to ensure its value is 1.