mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-02 19:26:44 +00:00
save a second if we're already ready
This commit is contained in:
parent
ff23ad1b89
commit
68036dd773
@ -444,7 +444,6 @@ def await_client_ready(process, timeout=10, liveness=60*2):
|
|||||||
"""
|
"""
|
||||||
start = time.time()
|
start = time.time()
|
||||||
while (time.time() - start) < float(timeout):
|
while (time.time() - start) < float(timeout):
|
||||||
time.sleep(1)
|
|
||||||
try:
|
try:
|
||||||
data = web_get(process.node_dir, u"", params={u"t": u"json"})
|
data = web_get(process.node_dir, u"", params={u"t": u"json"})
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
@ -452,6 +451,7 @@ def await_client_ready(process, timeout=10, liveness=60*2):
|
|||||||
js = json.loads(data)
|
js = json.loads(data)
|
||||||
if len(js['servers']) == 0:
|
if len(js['servers']) == 0:
|
||||||
print("waiting because no servers at all")
|
print("waiting because no servers at all")
|
||||||
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
server_times = [
|
server_times = [
|
||||||
server['last_received_data']
|
server['last_received_data']
|
||||||
@ -461,11 +461,13 @@ def await_client_ready(process, timeout=10, liveness=60*2):
|
|||||||
# contacted (so it's down still, probably)
|
# contacted (so it's down still, probably)
|
||||||
if any([t is None for t in server_times]):
|
if any([t is None for t in server_times]):
|
||||||
print("waiting because at least one server not contacted")
|
print("waiting because at least one server not contacted")
|
||||||
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# check that all times are 'recent enough'
|
# check that all times are 'recent enough'
|
||||||
if any([time.time() - t > liveness for t in server_times]):
|
if any([time.time() - t > liveness for t in server_times]):
|
||||||
print("waiting because at least one server too old")
|
print("waiting because at least one server too old")
|
||||||
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# we have a status with at least one server, and all servers
|
# we have a status with at least one server, and all servers
|
||||||
|
Loading…
Reference in New Issue
Block a user