Lower connection timeout duration

web_utils
Tyler Goodlet 2021-05-28 09:38:57 -04:00
parent b689adaeb0
commit 51a8308105
1 changed files with 2 additions and 3 deletions

View File

@ -72,7 +72,6 @@ _ohlc_dtype = [
ohlc_dtype = np.dtype(_ohlc_dtype) ohlc_dtype = np.dtype(_ohlc_dtype)
_show_wap_in_history = False _show_wap_in_history = False
_search_conf = {'pause_period': 0.0616}
# https://binance-docs.github.io/apidocs/spot/en/#exchange-information # https://binance-docs.github.io/apidocs/spot/en/#exchange-information
@ -301,13 +300,13 @@ async def stream_messages(ws):
timeouts = 0 timeouts = 0
while True: while True:
with trio.move_on_after(5) as cs: with trio.move_on_after(3) as cs:
msg = await ws.recv_msg() msg = await ws.recv_msg()
if cs.cancelled_caught: if cs.cancelled_caught:
timeouts += 1 timeouts += 1
if timeouts > 10: if timeouts > 2:
log.error("binance feed seems down and slow af? rebooting...") log.error("binance feed seems down and slow af? rebooting...")
await ws._connect() await ws._connect()