This commit is contained in:
Jack Robison 2020-01-12 19:14:45 -05:00
parent 8098438882
commit b75077c1e4
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 7 additions and 1 deletions

View file

@ -90,6 +90,7 @@ class ClientSession(BaseClientSession):
while True: while True:
try: try:
if self.is_closing(): if self.is_closing():
log.warning("is closing, reconnect")
await self.create_connection(self.timeout) await self.create_connection(self.timeout)
await self.ensure_server_version() await self.ensure_server_version()
self._on_connect_cb() self._on_connect_cb()
@ -99,10 +100,14 @@ class ClientSession(BaseClientSession):
except RPCError as e: except RPCError as e:
log.warning("Server error, ignoring for 1h: %s:%d -- %s", *self.server, e.message) log.warning("Server error, ignoring for 1h: %s:%d -- %s", *self.server, e.message)
retry_delay = 60 * 60 retry_delay = 60 * 60
except (asyncio.TimeoutError, OSError): except asyncio.TimeoutError:
log.error("closing due to timeout")
await self.close() await self.close()
retry_delay = min(60, retry_delay * 2) retry_delay = min(60, retry_delay * 2)
log.warning("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server) log.warning("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server)
except Exception:
log.exception("unexpected error")
raise
try: try:
await asyncio.wait_for(self.trigger_urgent_reconnect.wait(), timeout=retry_delay) await asyncio.wait_for(self.trigger_urgent_reconnect.wait(), timeout=retry_delay)
except asyncio.TimeoutError: except asyncio.TimeoutError:

View file

@ -115,6 +115,7 @@ class SessionBase(asyncio.Protocol):
try: try:
await asyncio.wait_for(self._can_send.wait(), secs) await asyncio.wait_for(self._can_send.wait(), secs)
except asyncio.TimeoutError: except asyncio.TimeoutError:
self.logger.warning("abort connection after limited wait (%s)", secs)
self.abort() self.abort()
raise asyncio.TimeoutError(f'task timed out after {secs}s') raise asyncio.TimeoutError(f'task timed out after {secs}s')