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

Allow controller to reconnect to compute if communication is lost. Ref #1634

This commit is contained in:
grossmj 2020-03-19 18:02:01 +10:30
parent aa1b621c10
commit b24bb42a66

View File

@ -448,11 +448,11 @@ class Compute:
log.error("Error received on compute WebSocket '{}': {}".format(ws_url, ws.exception())) log.error("Error received on compute WebSocket '{}': {}".format(ws_url, ws.exception()))
elif response.type == aiohttp.WSMsgType.CLOSED: elif response.type == aiohttp.WSMsgType.CLOSED:
pass pass
self._connected = False
break break
except aiohttp.client_exceptions.ClientResponseError as e: except aiohttp.client_exceptions.ClientResponseError as e:
log.error("Client response error received on compute WebSocket '{}': {}".format(ws_url,e)) log.error("Client response error received on compute WebSocket '{}': {}".format(ws_url,e))
finally: finally:
self._connected = False
log.info("Connection closed to compute WebSocket '{}'".format(ws_url)) log.info("Connection closed to compute WebSocket '{}'".format(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)