From: Andrew W. Donoho Date: Thu, 16 Jan 2014 21:11:40 +0000 (-0600) Subject: Increase the size of the read buffer to be larger than the average tweet. X-Git-Tag: twitter-1.11.0~3^2~2^2~3 X-Git-Url: https://jfr.im/git/z_archive/twitter.git/commitdiff_plain/ef99d73454c85384ada9b11abf29571f504e6db8?ds=sidebyside Increase the size of the read buffer to be larger than the average tweet. --- diff --git a/twitter/stream.py b/twitter/stream.py index 094b5f9..0d8d86f 100644 --- a/twitter/stream.py +++ b/twitter/stream.py @@ -62,7 +62,7 @@ class TwitterJSONIter(object): else: yield {"timeout":True} else: - self.buf += sock.recv(1024) # As tweets are typically longer than 1KB, consider increasing this size. + self.buf += sock.recv(2048) except SSLError as e: if (not self.block or self.timeout) and (e.errno == 2): # Apparently this means there was nothing in the socket buf