mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-25 01:38: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:
parent
71725aade6
commit
6b0d0de1bc
@ -348,7 +348,7 @@ class Controller:
|
|||||||
self._computes[compute.id] = compute
|
self._computes[compute.id] = compute
|
||||||
#self.save()
|
#self.save()
|
||||||
if connect:
|
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__())
|
self.notification.controller_emit("compute.created", compute.__json__())
|
||||||
return compute
|
return compute
|
||||||
else:
|
else:
|
||||||
|
@ -473,7 +473,8 @@ class Compute:
|
|||||||
log.info("Connection closed to compute '{}' WebSocket '{}'".format(self._id, ws_url))
|
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)
|
# 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()))
|
asyncio.get_event_loop().call_later(1, lambda: asyncio.ensure_future(self.connect()))
|
||||||
|
|
||||||
self._cpu_usage_percent = None
|
self._cpu_usage_percent = None
|
||||||
|
@ -320,8 +320,7 @@ class Server:
|
|||||||
port=port,
|
port=port,
|
||||||
access_log=access_log,
|
access_log=access_log,
|
||||||
ssl_certfile=config.Server.certfile,
|
ssl_certfile=config.Server.certfile,
|
||||||
ssl_keyfile=config.Server.certkey,
|
ssl_keyfile=config.Server.certkey)
|
||||||
lifespan="on")
|
|
||||||
|
|
||||||
# overwrite uvicorn loggers with our own logger
|
# overwrite uvicorn loggers with our own logger
|
||||||
for uvicorn_logger_name in ("uvicorn", "uvicorn.error"):
|
for uvicorn_logger_name in ("uvicorn", "uvicorn.error"):
|
||||||
|
Loading…
Reference in New Issue
Block a user