Fix low latency bug in public method BfxWebSocketBucket::start.

This commit is contained in:
Davide Casale
2023-12-14 18:35:00 +01:00
parent 9114e2ceec
commit 97bad7f4fb

View File

@@ -67,8 +67,9 @@ class BfxWebSocketBucket(Connection):
if isinstance(message, list):
if (chan_id := cast(int, message[0])) and \
(message[1] != Connection._HEARTBEAT):
self.__handler.handle(self.__subscriptions[chan_id], message[1:])
(subscription := self.__subscriptions.get(chan_id)) and \
(message[1] != Connection._HEARTBEAT):
self.__handler.handle(subscription, message[1:])
def __on_subscribed(self, message: Dict[str, Any]) -> None:
chan_id = cast(int, message["chan_id"])