From 746db60e5b7c4849a9db014f3d31fb949b7a07d2 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 20 Dec 2021 14:16:38 -0500 Subject: [PATCH] Increases IB api connect timeout to 1s --- piker/brokers/ib.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index ed479c38..b378f5f2 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -739,11 +739,13 @@ async def load_aio_clients( client_id: Optional[int] = None, ) -> Client: - '''Return an ``ib_insync.IB`` instance wrapped in our client API. + ''' + Return an ``ib_insync.IB`` instance wrapped in our client API. Client instances are cached for later use. TODO: consider doing this with a ctx mngr eventually? + ''' global _accounts2clients, _client_cache, _scan_ignore @@ -782,7 +784,7 @@ async def load_aio_clients( try_ports = list(ports.values()) ports = try_ports if port is None else [port] # we_connected = [] - connect_timeout = 0.5 if platform.system() != 'Windows' else 1 + connect_timeout = 1 if platform.system() != 'Windows' else 2 combos = list(itertools.product(hosts, ports)) # allocate new and/or reload disconnected but cached clients @@ -1300,6 +1302,10 @@ async def _setup_quote_stream( # resulting in tracebacks spammed to console.. # Manually do the dereg ourselves. teardown() + except trio.WouldBlock: + log.warning(f'channel is blocking symbol feed for {symbol}?' + f'\n{to_trio.statistics}' + ) # except trio.WouldBlock: # # for slow debugging purposes to avoid clobbering prompt