Raise cache miss on a disconnected ib client

pause_feeds_on_sym_switch
Tyler Goodlet 2021-08-18 15:15:28 -04:00
parent c6aa867c9b
commit ffbfd187ad
1 changed files with 4 additions and 1 deletions

View File

@ -701,6 +701,10 @@ async def _aio_get_client(
# grab first cached client
client = list(_client_cache.values())[0]
if not client.ib.isConnected():
# we have a stale client to re-allocate
raise KeyError
yield client
except (KeyError, IndexError):
@ -780,7 +784,6 @@ async def _aio_run_client_method(
kwargs['to_trio'] = to_trio
log.runtime(f'Running {meth}({kwargs})')
return await async_meth(**kwargs)