Response Streaming in JS#3395
Conversation
67d7c74 to
249285b
Compare
|
Is there a test for checking that the GraphBinaryReader handles values that are input across chunk boundaries? This is technically covered by the new tests for the StreamReader, but it isn't quite the integration test that I'm expecting as it doesn't go from test input through the GraphBinary deserializers. |
GumpacG
left a comment
There was a problem hiding this comment.
Could you also add an integration test that would verify early result consumption before the full response completes?
Otherwise, LGTM. VOTE +1
Add streaming HTTP response handling to gremlin-javascript, enabling incremental result consumption via fetch response.body ReadableStream. - Add StreamReader abstraction for async byte reading over streaming and buffered sources - Refactor all ~20 GraphBinary serializers from sync deserialize(buffer) to async deserialize(reader) - Refactor GraphBinaryReader.readResponse() to use StreamReader - Add Connection.stream() using fetch response.body ReadableStream - Add Client.stream() returning AsyncGenerator - Wire Traversal API (next(), hasNext(), toList()) to streaming for incremental consumption, matching Go GLV behavior - submit() remains non-streaming, buffers full response - Remove dead readable-stream dependency and Readable imports
249285b to
6b3ccac
Compare
I've added some cases at the end of GraphBinaryReader-test.js to give more coverage here. They validate that GraphBinaryReader can handle items split across chunk boundaries, as well as validating it can incrementally produce the first result prior to all data being available in to the stream. It doesn't quite reach the level of a full integration test as it's not wired into DRC. Such a test would be useful but needs dedicated server infrastructure, which I consider out of scope here.
Piggy-backing on my above response, I believe the new unit tests added to GraphBinaryReader are the best we can reasonably do for now, without dedicated server infrastructure to control size and timing of response chunks. |
|
VOTE +1 |
1 similar comment
|
VOTE +1 |
Add streaming HTTP response handling to gremlin-javascript, enabling incremental result consumption via fetch response.body ReadableStream.
VOTE +1