text exporter

This commit is contained in:
Dobromir Popov
2025-08-26 18:16:12 +03:00
parent c39b70f6fa
commit 9a76624904
9 changed files with 658 additions and 106 deletions

View File

@@ -446,8 +446,8 @@ class EnhancedCOBWebSocket:
# Add ping/pong handling and proper connection management
async with websockets_connect(
ws_url,
ping_interval=20, # Binance sends ping every 20 seconds
ping_timeout=60, # Binance disconnects after 1 minute without pong
ping_interval=25, # Slightly longer than default
ping_timeout=90, # Allow longer time before timeout
close_timeout=10
) as websocket:
# Connection successful
@@ -539,8 +539,11 @@ class EnhancedCOBWebSocket:
# Wait before reconnecting
status.increase_reconnect_delay()
logger.info(f"Waiting {status.reconnect_delay:.1f}s before reconnecting {symbol}")
await asyncio.sleep(status.reconnect_delay)
# Add jitter to avoid synchronized reconnects
jitter = 0.5 + (random.random() * 1.5)
delay = status.reconnect_delay * jitter
logger.info(f"Waiting {delay:.1f}s before reconnecting {symbol}")
await asyncio.sleep(delay)
async def _process_websocket_message(self, symbol: str, data: Dict):
"""Process WebSocket message and convert to COB format