From e92abd376ab982539523089bd3df9c841271a27c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 2 Aug 2020 01:35:29 -0400 Subject: [PATCH] Trace log the heartbeat --- piker/brokers/kraken.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/piker/brokers/kraken.py b/piker/brokers/kraken.py index 448097e8..5fd9216b 100644 --- a/piker/brokers/kraken.py +++ b/piker/brokers/kraken.py @@ -181,11 +181,20 @@ async def stream_quotes( async def recv(): return json.loads(await ws.get_message()) + import time + async def recv_ohlc(): + last_hb = 0 while True: msg = await recv() if isinstance(msg, dict): if msg.get('event') == 'heartbeat': + log.trace( + f"Heartbeat after {time.time() - last_hb}") + last_hb = time.time() + # TODO: hmm i guess we should use this + # for determining when to do connection + # resets eh? continue err = msg.get('errorMessage') if err: