`ib`: stick exc handler around client connection erros

rekt_pps
Tyler Goodlet 2023-03-23 10:10:34 -04:00
parent 59b095b2d5
commit 199a5e8b38
1 changed files with 12 additions and 2 deletions

View File

@ -736,9 +736,19 @@ async def stream_quotes(
sym = symbols[0] sym = symbols[0]
log.info(f'request for real-time quotes: {sym}') log.info(f'request for real-time quotes: {sym}')
proxy: MethodProxy
async with open_data_client() as proxy: async with open_data_client() as proxy:
con, first_ticker, details = await proxy.get_sym_details(symbol=sym) try:
(
con,
first_ticker,
details,
) = await proxy.get_sym_details(symbol=sym)
except ConnectionError:
log.exception(f'Proxy is ded {proxy._aio_ns}')
raise
first_quote = normalize(first_ticker) first_quote = normalize(first_ticker)
# print(f'first quote: {first_quote}') # print(f'first quote: {first_quote}')
@ -825,7 +835,7 @@ async def stream_quotes(
await trio.sleep_forever() await trio.sleep_forever()
return # we never expect feed to come up? return # we never expect feed to come up?
cs: Optional[trio.CancelScope] = None cs: trio.CancelScope | None = None
startup: bool = True startup: bool = True
while ( while (
startup startup