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

Parsing shouldn't end when the stream has no bytes available #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MihaiDamian
Copy link

The parser currently stops if the input stream has no available bytes to read. This seems incorrect as parsing should normally continue until the stream is closed, at an end or when an error has occurred. If hasBytesAvailable returns no it doesn't imply any of these cases, it could just be that the input stream is not yet ready to hand out data.

I encountered this limitation while trying to set up a producer-consumer relation between a network operation that downloaded a CSV and CHCSVParser. Because of network delays the parser can often read from the stream faster than the network operation can write.

The solution in this pull request is to wait in _loadMoreIfNecessary until further data is available, the stream ends or parsing is canceled.

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

Successfully merging this pull request may close these issues.

None yet

2 participants