1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-25 16:28:11 +00:00

Fix stacktrace display when connecting to remote server

Fix #891
This commit is contained in:
Julien Duponchelle 2017-02-06 17:56:08 +01:00
parent 6ded234681
commit 94fd4bcbe9
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -361,6 +361,16 @@ class Compute:
response = yield from self._run_http_query(method, path, data=data, **kwargs)
return response
@asyncio.coroutine
def _try_reconnect(self):
"""
We catch error during reconnect
"""
try:
yield from self.connect()
except aiohttp.web.HTTPConflict:
pass
@locked_coroutine
def connect(self):
"""
@ -375,8 +385,10 @@ class Compute:
self._connection_failure += 1
# After 5 failure we close the project using the compute to avoid sync issues
if self._connection_failure == 5:
log.warning("Can't connect to compute %s", self._id)
yield from self._controller.close_compute_projects(self)
asyncio.get_event_loop().call_later(2, lambda: asyncio.async(self.connect()))
asyncio.get_event_loop().call_later(2, lambda: asyncio.async(self._try_reconnect()))
return
except aiohttp.web.HTTPNotFound: