From 199a5e8b38a650f4a25644b965bdf2219835d1c8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 23 Mar 2023 10:10:34 -0400 Subject: [PATCH] `ib`: stick exc handler around client connection erros --- piker/brokers/ib/feed.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/piker/brokers/ib/feed.py b/piker/brokers/ib/feed.py index d16a02a9..ead4b8e4 100644 --- a/piker/brokers/ib/feed.py +++ b/piker/brokers/ib/feed.py @@ -736,9 +736,19 @@ async def stream_quotes( sym = symbols[0] log.info(f'request for real-time quotes: {sym}') + proxy: MethodProxy 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) # print(f'first quote: {first_quote}') @@ -825,7 +835,7 @@ async def stream_quotes( await trio.sleep_forever() return # we never expect feed to come up? - cs: Optional[trio.CancelScope] = None + cs: trio.CancelScope | None = None startup: bool = True while ( startup