-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
iter_lines small chunks #539
Comments
Hmm, it might be actually :) Someone implemented "proper" chunks, but it caused way more problems than it solved, so we took it out. |
So, I had opened #533, came back to update it about I guess there aren't many ways to read lines from a blocking socket, so Still, I would like to raise two points:
|
Good thoughts, @mponton :) +1 on both of them. |
1: It originally did have a default size of 2: 👍 |
I still think |
On 2: I was thinking a bit more on this, shouldn't this also apply to I think That said, all this is really only necessary for streaming connections AFAIK. A |
Agreed, leaving You may want to add a short note in the documentation though. People may change the |
I see no connection between size of |
So using a |
Well, if |
@mponton when |
@kennethreitz Well, of course it will be. You're reading "chunks" of 1 byte at a time. However, when we talked about changing the default That said, I'm open to alternatives, but unless you start polling the socket in non-blocking mode, the @piotr-dobrogost If you know of another implementation to read lines as they come in from a socket while using blocking I/O, please feel free to let me (or us) know. I'm not trying to sell my quick fix to anyone, I'm simply trying to find a way to have @kennethreitz Also, if you feel |
@mponton would |
It may limit the number of reads on the socket, but you'd have to handle cases where I/O would block (EWOULDBLOCK) when no data is available. The next step would be to go completely async behind the scene in If you expect to have hundred of lines per seconds in the streaming response, you could still set the |
That makes sense; we'd need our own event loop, and it probably wouldn't play nice with the |
I'm writing a script to track keywords in the twitter realtime api.
At first, I was using requests v0.10.8. Showing the tweets was almost instant, but the issue #515 occured frequently.
Then I upgraded requests to v0.11.1. Now #515 is resolved, but apparently small chunks are not processed instantly, if they don't reach the
chunk_size
. By setting the chunk size to a value like 10, it works, but that can't be the solution :)The text was updated successfully, but these errors were encountered: