From 4a8ba594d1b01cb61007dd223cfff35b910b4d97 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 10 Feb 2021 12:30:56 -0800 Subject: TorMgr: Change new identity cooldown to 7 seconds instead of 6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because sometimes a new identity was not being respected Signed-off-by: Jesús --- youtube/util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'youtube/util.py') diff --git a/youtube/util.py b/youtube/util.py index 44ae1ba..701d922 100644 --- a/youtube/util.py +++ b/youtube/util.py @@ -61,9 +61,9 @@ connection_pool = urllib3.PoolManager(cert_reqs='CERT_REQUIRED') class TorManager: MAX_TRIES = 3 - # Remember the 6-sec wait times, so make cooldown be two of those + # Remember the 7-sec wait times, so make cooldown be two of those # (otherwise it will retry forever if 429s never end) - COOLDOWN_TIME = 12 + COOLDOWN_TIME = 14 def __init__(self): self.old_tor_connection_pool = None @@ -150,8 +150,8 @@ class TorManager: # be a new IP, based on experiments. # Not necessary after first new identity if original_try_num > 1: - print('Sleeping for 6 seconds before retrying request') - time.sleep(6) # experimentally determined minimum + print('Sleeping for 7 seconds before retrying request') + time.sleep(7) # experimentally determined minimum return None finally: -- cgit v1.2.3