-
Notifications
You must be signed in to change notification settings - Fork 829
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
chore(sse): refactor sse utils with cursor #4356
Conversation
"\n\n" in chunk | ||
or chunk | ||
and chunk[0] == "\n" | ||
and last_chunk | ||
and last_chunk[-1] == "\n" |
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.
Is this part needed? Could we always just append the buffer until we see \n\n
and then update the cursor?
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.
Chunking may happen right in the middle of \n\n
and break down it into two chunks
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.
Yeah, if that happens maybe we just simply wait for the next chunk to arrive?
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 don't think so. You may take a closer look at the process here, or edit as you want and check if the unit test can still pass.
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.
Right, i understood what you wrote. I think we can just have while '\n\n' in chunks
condition, and that will solve two problem at once:
- The scenario you mentioned, where its chunked between two
\n
character, it will simply wait for the next chunk to enter the buffer then we will have the full delimiter again. - Multiple events in the same chunk, it will then yield multiple times before it receives the next chunk into buffer
open from another branch |
What does this PR address?
Fixes #(issue)
Before submitting:
guide on how to create a pull request.
pre-commit run -a
script has passed (instructions)?those accordingly? Here are documentation guidelines and tips on writting docs.