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: Only call getResumptionRequestFn once #1593

Merged
merged 7 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gax/src/streamingCalls/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class StreamProxy extends duplexify implements GRPCCallResult {
const resumptionRetryArgument =
retry.getResumptionRequestFn(retryArgument);
if (resumptionRetryArgument !== undefined) {
retryArgument = retry.getResumptionRequestFn(retryArgument);
retryArgument = resumptionRetryArgument;
}
}
this.resetStreams(stream);
Expand Down
5 changes: 3 additions & 2 deletions gax/test/unit/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1157,10 +1157,10 @@ describe('streaming', () => {
true // new retry behavior enabled
);
// resumption strategy is to pass a different arg to the function
const getResumptionRequestFn = (originalRequest: RequestType) => {
const getResumptionRequestFn = sinon.spy((originalRequest: RequestType) => {
assert.strictEqual(originalRequest.arg, 0);
return {arg: 2};
};
});
const s = apiCall(
{arg: 0},
{
Expand Down Expand Up @@ -1194,6 +1194,7 @@ describe('streaming', () => {
receivedData.join(' '),
'Hello World testing retries'
);
assert.strictEqual(getResumptionRequestFn.callCount, 1);
done();
});
});
Expand Down
Loading