-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handle long messages in event parser #2
Conversation
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.
Thank you for raising the issue and the PR! The requested changes address only some style preferences. It's also great you've added tests for this edge case – seems like I missed that part of bufio.Scanner
's behavior. I appreciate you taking time to find and fix this issue. Was it easy navigating the codebase? If you have any naming/layout/other suggestions, please let me know.
Also make sure to rebase on master – I've updated and fixed the actions. |
de55b92
to
fb68785
Compare
Thanks for the feedback! I've rebased and updated the PR based on your comments. I found most of the codebase quite easy to follow, particularly the top-level package and the readme documentation. It did take me some time to wrap my head around the Other than that, though, I had no trouble understanding and navigating the codebase. |
That's a very useful suggestion, thank you! I'll implement it in another PR. Will merge your PR and release a new version soon, as I've found another bug and an opportunity to remove some code from the codebase. |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #2 +/- ##
==========================================
+ Coverage 96.39% 96.41% +0.02%
==========================================
Files 14 14
Lines 1054 1060 +6
==========================================
+ Hits 1016 1022 +6
Misses 30 30
Partials 8 8
☔ View full report in Codecov by Sentry. |
See latest release. I've also made the suggested refactor. |
This PR fixes a bug that causes the
go-sse
client to drop messages that are longer than 4096 bytes with an Unexpected EOF error.The issue here is that the
Scanner
that gets used to fill the input buffer for the byte parser (which gets used to extract fields) may not call theSplitFunc
with a buffer containing a full token. In that case, the split function needs to request more data, signalling to theScanner
to call theSplitFunc
again with a larger buffer.This PR includes a new test case in
TestReaderParser
that fails if this change is not present, along with a new test ininternal/parser/split_func_test.go
.