Skip to content

Commit

Permalink
Fix low latency bug in public method BfxWebSocketBucket::start.
Browse files Browse the repository at this point in the history
  • Loading branch information
Davi0kProgramsThings committed Dec 14, 2023
1 parent 9114e2c commit 97bad7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bfxapi/websocket/_client/bfx_websocket_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ async def start(self) -> None:

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"])
Expand Down

0 comments on commit 97bad7f

Please sign in to comment.