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: delta stream parser #1280

Merged
merged 2 commits into from
Jun 23, 2023
Merged

fix: delta stream parser #1280

merged 2 commits into from
Jun 23, 2023

Conversation

jczhong84
Copy link
Collaborator

Previously when the stream ends with non-empty buffer, the data in the buffer will not be flushed to the final result.

@@ -48,6 +48,18 @@ export class DeltaStreamParser {
return { ...this._result };
}

public getResult(ended: boolean): { [key: string]: string } {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit iffy about having mutation in getter. What about just rename this to ?

public close() { ... }

then at the end you do:

parser.close();
onStreamingEnd?.(parser.result);

also change result into a getter like

public get result() { return {...this._result} }

then the parse code can be:

parser.parse(delta);
onStreaming(parser.result);

@jczhong84 jczhong84 merged commit b4da637 into pinterest:master Jun 23, 2023
3 checks passed
@jczhong84 jczhong84 deleted the fix/parser branch June 23, 2023 20:51
aidenprice pushed a commit to arrowtail-precision/querybook that referenced this pull request Jan 3, 2024
* fix: delta stream  parser

* comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants