From: Harmon Date: Wed, 2 Nov 2022 01:37:56 +0000 (-0500) Subject: Change initial network_error_wait to 0 for streaming X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b18c1a6239e81cb5744fa99d392ec539de787e5c;p=tweepy.git Change initial network_error_wait to 0 for streaming Attempt to reconnect immediately when established streaming connection drops --- diff --git a/tweepy/asynchronous/streaming.py b/tweepy/asynchronous/streaming.py index 1d520e2..0bf6a49 100644 --- a/tweepy/asynchronous/streaming.py +++ b/tweepy/asynchronous/streaming.py @@ -46,7 +46,8 @@ class AsyncBaseStream: # https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/connecting # https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/integrate/handling-disconnections # https://developer.twitter.com/en/docs/twitter-api/tweets/volume-streams/integrate/handling-disconnections - network_error_wait = network_error_wait_step = 0.25 + network_error_wait = 0 + network_error_wait_step = 0.25 network_error_wait_max = 16 http_error_wait = http_error_wait_start = 5 http_error_wait_max = 320 @@ -73,7 +74,7 @@ class AsyncBaseStream: if resp.status == 200: error_count = 0 http_error_wait = http_error_wait_start - network_error_wait = network_error_wait_step + network_error_wait = 0 await self.on_connect() diff --git a/tweepy/streaming.py b/tweepy/streaming.py index efa56f2..db635bf 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -61,7 +61,8 @@ class BaseStream: # https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/connecting # https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/integrate/handling-disconnections # https://developer.twitter.com/en/docs/twitter-api/tweets/volume-streams/integrate/handling-disconnections - network_error_wait = network_error_wait_step = 0.25 + network_error_wait = 0 + network_error_wait_step = 0.25 network_error_wait_max = 16 http_error_wait = http_error_wait_start = 5 http_error_wait_max = 320 @@ -80,7 +81,7 @@ class BaseStream: if resp.status_code == 200: error_count = 0 http_error_wait = http_error_wait_start - network_error_wait = network_error_wait_step + network_error_wait = 0 self.on_connect() if not self.running: