worker: check tor every 30s instead of exponential backoff
This commit is contained in:
9
ppf.py
9
ppf.py
@@ -521,8 +521,8 @@ def worker_main(config):
|
||||
wstate['backoff'] = min(wstate['backoff'] * 2, 300) # Max 5 min backoff
|
||||
|
||||
def wait_for_tor():
|
||||
"""Wait for Tor to become available, with exponential backoff."""
|
||||
backoff = 10
|
||||
"""Wait for Tor to become available, checking every 30 seconds."""
|
||||
check_interval = 30
|
||||
while True:
|
||||
working, tor_ip = check_tor_connectivity(config.torhosts)
|
||||
if working:
|
||||
@@ -533,14 +533,13 @@ def worker_main(config):
|
||||
except NeedReregister:
|
||||
do_register()
|
||||
return working, tor_ip
|
||||
_log('tor still down, retrying in %ds' % backoff, 'warn')
|
||||
_log('tor still down, retrying in %ds' % check_interval, 'warn')
|
||||
# Send heartbeat with tor_ok=False
|
||||
try:
|
||||
worker_send_heartbeat(server_url, wstate['worker_key'], False, None, worker_profiling)
|
||||
except NeedReregister:
|
||||
do_register()
|
||||
time.sleep(backoff)
|
||||
backoff = min(backoff * 2, 300) # Max 5 min backoff
|
||||
time.sleep(check_interval)
|
||||
|
||||
try:
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user