-
Notifications
You must be signed in to change notification settings - Fork 87
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: overhaul of server streaming retries #1653
Conversation
…gErrorhanodffhandler
assert.strictEqual(error.code, 4); | ||
assert.strictEqual( | ||
error.message, | ||
'Total timeout of API exceeded 2 milliseconds retrying error Error: 6 ALREADY_EXISTS: 6 before any response was received.' |
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.
It's possible I need to update this to be less strict - I have also seen it error on the second error in the sequence
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.
I added a try catch here because I think it can be either the first or the second error code
"google-gax": "file:./google-gax.tgz", | ||
"google-gax": "file:google-gax.tgz", | ||
"protobufjs": "^7.0.0", | ||
"pumpify": "^2.0.1", |
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.
What are your thoughts on using Readable.from
rather than pumpify
?
Example:
async function* concatStreams(streams: ReadableStream[]) {
for (const stream of streams) {
yield* stream;
}
}
const readable = Readable.from(concatStreams());
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.
Great question- generally I prefer to use pipeline
instead of pumpify
, but I explicitly want pumpify as part of the test application because I know it's used in at least one of the client libraries and was related to the issue that this PR is fixing. I will add comments around that though, and if you want to see a test including Readable.from as an option, I can do that too
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.
For now, I have reorganized all of the pumpify and all of the pipeline ones (I know, the organization of test application is a lil chaotic at this point) and I added comments about why they're both there. Lmk if you want me to add Readable.from tests also
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.
Ideally, we'd want to recommend whoever's using pumpify
off of it, as itself is pretty flaky. That would likely be a semver-major issue though.
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.
@danielbankhead let me know what the preferred action within gax is - I can open an issue in the affected client library to stop using pumpify
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.
I created an issue to migrate the stakeholder off of pumpify, and I'm going to merge this for now. If you want to create an issue to have it removed later please feel free to!
"google-gax": "file:./google-gax.tgz", | ||
"google-gax": "file:google-gax.tgz", | ||
"protobufjs": "^7.0.0", | ||
"pumpify": "^2.0.1", |
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.
Ideally, we'd want to recommend whoever's using pumpify
off of it, as itself is pretty flaky. That would likely be a semver-major issue though.
#1657 blocking tests |
This is a huge PR, sorry. I had hoped to break it into smaller chunks, but it got to a point where I had to rip the bandaid off and just go for it. There will be a followup PR that adds some more tests I have to the test application regarding buffers and pipelines.
Code changes
gax/src/gax.ts
gax/src/streamingCalls/streaming.ts
Removes
Test application
Unit tests
Things I'm not sure about