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
|
wstate['backoff'] = min(wstate['backoff'] * 2, 300) # Max 5 min backoff
|
||||||
|
|
||||||
def wait_for_tor():
|
def wait_for_tor():
|
||||||
"""Wait for Tor to become available, with exponential backoff."""
|
"""Wait for Tor to become available, checking every 30 seconds."""
|
||||||
backoff = 10
|
check_interval = 30
|
||||||
while True:
|
while True:
|
||||||
working, tor_ip = check_tor_connectivity(config.torhosts)
|
working, tor_ip = check_tor_connectivity(config.torhosts)
|
||||||
if working:
|
if working:
|
||||||
@@ -533,14 +533,13 @@ def worker_main(config):
|
|||||||
except NeedReregister:
|
except NeedReregister:
|
||||||
do_register()
|
do_register()
|
||||||
return working, tor_ip
|
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
|
# Send heartbeat with tor_ok=False
|
||||||
try:
|
try:
|
||||||
worker_send_heartbeat(server_url, wstate['worker_key'], False, None, worker_profiling)
|
worker_send_heartbeat(server_url, wstate['worker_key'], False, None, worker_profiling)
|
||||||
except NeedReregister:
|
except NeedReregister:
|
||||||
do_register()
|
do_register()
|
||||||
time.sleep(backoff)
|
time.sleep(check_interval)
|
||||||
backoff = min(backoff * 2, 300) # Max 5 min backoff
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user