mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2026-01-22 23:14:27 +01:00
Allow wss_timeout=None to disable timeout on reconnection.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import List, Optional
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
from .rest import BfxRestInterface
|
||||
from .websocket import BfxWebsocketClient
|
||||
@@ -13,9 +13,9 @@ class Client:
|
||||
*,
|
||||
rest_host: str = REST_HOST,
|
||||
wss_host: str = WSS_HOST,
|
||||
wss_timeout: float = 60 * 15,
|
||||
wss_timeout: Optional[float] = 60 * 15,
|
||||
log_filename: Optional[str] = None,
|
||||
log_level: str = "INFO"
|
||||
log_level: Literal["ERROR", "WARNING", "INFO", "DEBUG"] = "INFO"
|
||||
):
|
||||
credentials = None
|
||||
|
||||
|
||||
@@ -129,7 +129,8 @@ class BfxWebsocketClient:
|
||||
|
||||
reconnection = Reconnection(status=False, attempts=0, timestamp=None)
|
||||
|
||||
timer.cancel()
|
||||
if isinstance(timer, asyncio.events.TimerHandle):
|
||||
timer.cancel()
|
||||
|
||||
self.websocket = websocket
|
||||
|
||||
@@ -198,7 +199,10 @@ class BfxWebsocketClient:
|
||||
task.cancel()
|
||||
|
||||
reconnection = Reconnection(status=True, attempts=1, timestamp=datetime.now())
|
||||
timer = asyncio.get_event_loop().call_later(self.wss_timeout, _on_wss_timeout)
|
||||
|
||||
if self.wss_timeout is not None:
|
||||
timer = asyncio.get_event_loop().call_later(self.wss_timeout, _on_wss_timeout)
|
||||
|
||||
delay = _Delay(backoff_factor=1.618)
|
||||
|
||||
self.authentication = False
|
||||
|
||||
Reference in New Issue
Block a user