]> jfr.im git - z_archive/twitter.git/commitdiff
Increase the size of the read buffer to be larger than the average tweet.
authorAndrew W. Donoho <redacted>
Thu, 16 Jan 2014 21:11:40 +0000 (15:11 -0600)
committerAndrew W. Donoho <redacted>
Thu, 16 Jan 2014 21:11:40 +0000 (15:11 -0600)
twitter/stream.py

index 094b5f95482385825ebb19c9228f17690f16d86c..0d8d86fbff862865c722cff8c278b40a866f3b7f 100644 (file)
@@ -62,7 +62,7 @@ class TwitterJSONIter(object):
                     else:
                         yield {"timeout":True}
                 else:
                     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
             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