daemon.py busy-waits for port to be open
The code that waits for the daemon to have opened its port is essentially:
while True:
try:
s = socket.create_connection(addr, timeout=timeout)
s.close()
return
except socket.timeout:
logging.error(f"daemon did not respond at port {port} within {timeout} seconds")
raise
except socket.error as e:
logging.info(f"could not connect to daemon at {port}: {e}")
pass
Would it not make sense to have a time.sleep(0.1)
instead of pass
on the last line? It shouldn't affect the total time to wait in any significant manner, but would reduce the number of times the loop is iterated significantly.