1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Wait for local compute to be started.

Don't reconnect to local compute when server is being stopped.
This commit is contained in:
grossmj 2021-04-13 15:41:59 +09:30
parent 71725aade6
commit 6b0d0de1bc
3 changed files with 4 additions and 4 deletions

View File

@ -348,7 +348,7 @@ class Controller:
self._computes[compute.id] = compute
#self.save()
if connect:
asyncio.ensure_future(compute.connect())
asyncio.get_event_loop().call_later(1, lambda: asyncio.ensure_future(compute.connect()))
self.notification.controller_emit("compute.created", compute.__json__())
return compute
else:

View File

@ -473,7 +473,8 @@ class Compute:
log.info("Connection closed to compute '{}' WebSocket '{}'".format(self._id, ws_url))
# Try to reconnect after 1 second if server unavailable only if not during tests (otherwise we create a ressources usage bomb)
if not hasattr(sys, "_called_from_test") or not sys._called_from_test:
if self.id != "local" and not hasattr(sys, "_called_from_test") or not sys._called_from_test:
log.info("Reconnecting to to compute '{}' WebSocket '{}'".format(self._id, ws_url))
asyncio.get_event_loop().call_later(1, lambda: asyncio.ensure_future(self.connect()))
self._cpu_usage_percent = None

View File

@ -320,8 +320,7 @@ class Server:
port=port,
access_log=access_log,
ssl_certfile=config.Server.certfile,
ssl_keyfile=config.Server.certkey,
lifespan="on")
ssl_keyfile=config.Server.certkey)
# overwrite uvicorn loggers with our own logger
for uvicorn_logger_name in ("uvicorn", "uvicorn.error"):