aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-02-10 12:30:56 -0800
committerJesús <heckyel@hyperbola.info>2021-02-13 17:36:52 -0500
commit4a8ba594d1b01cb61007dd223cfff35b910b4d97 (patch)
treec1bf251f26e26f59c69d05d8923292722c997411
parent1cc0ffcb20e85eba8bfa2515936a149aa0a3f82c (diff)
downloadyt-local-4a8ba594d1b01cb61007dd223cfff35b910b4d97.tar.lz
yt-local-4a8ba594d1b01cb61007dd223cfff35b910b4d97.tar.xz
yt-local-4a8ba594d1b01cb61007dd223cfff35b910b4d97.zip
TorMgr: Change new identity cooldown to 7 seconds instead of 6
Because sometimes a new identity was not being respected Signed-off-by: Jesús <heckyel@hyperbola.info>
-rw-r--r--youtube/util.py8
1 files changed, 4 insertions, 4 deletions
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: