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

Stream reader #86

Merged
merged 3 commits into from
Apr 17, 2020
Merged

Conversation

alinagol
Copy link

Hi,

As it turns out, aiohttp does not handle json streams well.

Initially, we used iter_any to iterate through the logs, but the method implies \r\n delimiter (and RLP gateway messages are separated by \n\n), so some messages were skipped or merged into one.

The current solution is iterating through messages separated by \n. That should work fine for json streams, however there is a size limitation for messages - 128kb. So, yet again, a few messages are being skipped. The issue is know - rtfol/aiohttp-sse-client#11, aio-libs/aiohttp#4453,

Of course, I would prefer aiohttp to extend the functionality - either add a separator argument or a flexible size limit. However, it can take time.

In the meantime, I wrote a workaround, which allows to iterate through small chunks of data and separate messages by \n\n. Let me know what you think.

Thanks in advance!

@antechrestos
Copy link
Member

@alinagol Hello.

Thank you for your contribution. I will do a proper release in the next day.

@antechrestos antechrestos merged commit 75b6159 into cloudfoundry-community:master Apr 17, 2020
@alinagol
Copy link
Author

Thanks a lot for your constant cooperation :)

@antechrestos
Copy link
Member

Released in 1.12.5

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.

2 participants