From b14b3230685fe026a99edad4efc60dff9a7bd56a Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Wed, 15 Mar 2023 20:26:51 -0400 Subject: [PATCH] Remove breakpoint in web_bs, ensure we only unsub if ws is connected --- piker/brokers/kucoin.py | 19 ++++++++++--------- piker/data/_web_bs.py | 1 - 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/piker/brokers/kucoin.py b/piker/brokers/kucoin.py index 50a4ba5e..2d0efd7d 100644 --- a/piker/brokers/kucoin.py +++ b/piker/brokers/kucoin.py @@ -342,15 +342,16 @@ async def stream_quotes( yield # unsub - await ws.send_msg( - { - "id": connect_id, - "type": "unsubscribe", - "topic": f"/market/ticker:{sym}", - "privateChannel": False, - "response": True, - } - ) + if ws.connected(): + await ws.send_msg( + { + "id": connect_id, + "type": "unsubscribe", + "topic": f"/market/ticker:{sym}", + "privateChannel": False, + "response": True, + } + ) token = await client._get_ws_token() async with open_autorecon_ws( diff --git a/piker/data/_web_bs.py b/piker/data/_web_bs.py index 3a397f7e..21b06d68 100644 --- a/piker/data/_web_bs.py +++ b/piker/data/_web_bs.py @@ -100,7 +100,6 @@ class NoBsWs: last_err = None for i in range(tries): try: - breakpoint() self._ws = await self._stack.enter_async_context( trio_websocket.open_websocket_url(self.url) )