mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 21:43:09 +00:00
avoid re-computing the current time inside this loop
It could lead to funny behavior if we cross a boundary at just the wrong time. Also the debug print could be misleading in such a case.
This commit is contained in:
parent
c055c8e508
commit
14ebeba07d
@ -622,8 +622,9 @@ def await_client_ready(tahoe, timeout=10, liveness=60*2, minimum_number_of_serve
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
now = time.time()
|
||||
print(
|
||||
f"Now: {time.ctime()}\n"
|
||||
f"Now: {time.ctime(now)}\n"
|
||||
f"Server last-received-data: {[time.ctime(s['last_received_data']) for s in servers]}"
|
||||
)
|
||||
|
||||
@ -633,7 +634,7 @@ def await_client_ready(tahoe, timeout=10, liveness=60*2, minimum_number_of_serve
|
||||
]
|
||||
# check that all times are 'recent enough' (it's OK if _some_ servers
|
||||
# are down, we just want to make sure a sufficient number are up)
|
||||
if len([time.time() - t <= liveness for t in server_times if t is not None]) < minimum_number_of_servers:
|
||||
if len([now - t <= liveness for t in server_times if t is not None]) < minimum_number_of_servers:
|
||||
print("waiting because at least one server too old")
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user