Trace log the heartbeat
parent
bf9a0136df
commit
e92abd376a
|
@ -181,11 +181,20 @@ async def stream_quotes(
|
||||||
async def recv():
|
async def recv():
|
||||||
return json.loads(await ws.get_message())
|
return json.loads(await ws.get_message())
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
async def recv_ohlc():
|
async def recv_ohlc():
|
||||||
|
last_hb = 0
|
||||||
while True:
|
while True:
|
||||||
msg = await recv()
|
msg = await recv()
|
||||||
if isinstance(msg, dict):
|
if isinstance(msg, dict):
|
||||||
if msg.get('event') == 'heartbeat':
|
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
|
continue
|
||||||
err = msg.get('errorMessage')
|
err = msg.get('errorMessage')
|
||||||
if err:
|
if err:
|
||||||
|
|
Loading…
Reference in New Issue