docs: use async functions in gRPC streaming examples#2203
Open
bonnywelsford-source wants to merge 7 commits into
Open
docs: use async functions in gRPC streaming examples#2203bonnywelsford-source wants to merge 7 commits into
bonnywelsford-source wants to merge 7 commits into
Conversation
Streaming event handlers can only fire when the call stack is empty, so synchronous default functions prevent them from running. Update the server and client streaming examples to use async/await with Promises and add a short explanation of why async is required. Applies to next/ and v1.6.x. Made-with: Cursor
Contributor
|
💻 Deploy preview available (docs: use async functions in gRPC streaming examples): |
All code blocks on this page require a gRPC server at 127.0.0.1:10000 which is not available in CI. Skip the entire file, matching the pattern used by other external-service docs (Redis, MQTT, etc.). Made-with: Cursor
Collaborator
|
@bonnywelsford-source this looks good to me, but it would be nice to get one of the engineers to double-check this. @andrewslotin do you know if anyone on the squad might be able to take a quick look at this? 🙇 We also would need to update the v1.7.x version of the page before merging. |
Port the same gRPC page updates as next/ (async streaming examples, md-k6:skipall) so /docs/k6/latest reflects the change after merge. Made-with: Cursor
This file contains hidden or 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
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.
Summary
async.async/awaitwithPromise, replacing the previous synchronoussleep()-based approach.stream.on('error', ...)handlers to both examples.Addresses customer feedback that the gRPC streaming docs didn't explain the need for async functions, making it difficult to get streaming to work.
Applies to
next/andv1.6.x.Test plan
npm start, visit http://localhost:3002/docs/k6/next/using-k6/protocols/grpc/)Made with Cursor