Skip to content

Commit 97bad7f

Browse files
Fix low latency bug in public method BfxWebSocketBucket::start.
1 parent 9114e2c commit 97bad7f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bfxapi/websocket/_client/bfx_websocket_bucket.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ async def start(self) -> None:
6767

6868
if isinstance(message, list):
6969
if (chan_id := cast(int, message[0])) and \
70-
(message[1] != Connection._HEARTBEAT):
71-
self.__handler.handle(self.__subscriptions[chan_id], message[1:])
70+
(subscription := self.__subscriptions.get(chan_id)) and \
71+
(message[1] != Connection._HEARTBEAT):
72+
self.__handler.handle(subscription, message[1:])
7273

7374
def __on_subscribed(self, message: Dict[str, Any]) -> None:
7475
chan_id = cast(int, message["chan_id"])

0 commit comments

Comments
 (0)