This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
Fixed reading incomplete event JSON strings from the stream #97
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.
Overview
The event handler code that processes the stream input expects chunks to be full event strings (from the beginning of the string until the end of line character), which is not always true.
Because of that, sometimes incomplete JSON strings are read from the stream, which results in the following errors:
In this PR, I wrapped the original stream into the readline interface to ensure only full lines are passed to the consumer.
Which JIRA ticket does this PR relate to?
Add the link here. Create a ticket and link it here if one does not exist.
Complete this checklist before you submit this PR
bors r+
if GitHub policy is not enforced, e.g. when merging into another feature branch. It may be omitted under some circumstances if this PR intentionally assumes that integration tests will fail but will be fixed with the future PRs.Notes
I tried to preserve the original code structure. Not sure if it was needed.