Fix stacktrace display when connecting to remote server

Fix #891
pull/902/head
Julien Duponchelle 7 years ago
parent 6ded234681
commit 94fd4bcbe9
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -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:

Loading…
Cancel
Save