From 4a749f6c3834c4d5344b7d36dd8d02aa8ff3f791 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 7 Aug 2019 12:47:13 -0300 Subject: [PATCH] on timeout, restore latency to max --- torba/torba/client/basenetwork.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torba/torba/client/basenetwork.py b/torba/torba/client/basenetwork.py index a7fad05c0..fe166ba4f 100644 --- a/torba/torba/client/basenetwork.py +++ b/torba/torba/client/basenetwork.py @@ -40,6 +40,9 @@ class ClientSession(BaseClientSession): except RPCError as e: log.warning("Wallet server returned an error. Code: %s Message: %s", *e.args) raise e + except TimeoutError: + self.latency = 1 << 32 + raise async def ensure_session(self): # Handles reconnecting and maintaining a session alive @@ -50,7 +53,7 @@ class ClientSession(BaseClientSession): if self.is_closing(): await self.create_connection(self.timeout) await self.ensure_server_version() - if (time() - self.last_send) > self.max_seconds_idle: + if (time() - self.last_send) > self.max_seconds_idle or self.latency == 1 << 32: await self.send_request('server.banner') retry_delay = default_delay except (asyncio.TimeoutError, OSError):