dash interval updated
This commit is contained in:
@ -121,7 +121,7 @@ class COBDashboardServer:
|
||||
|
||||
# Initialize COB integration
|
||||
self.cob_integration = COBIntegration(symbols=self.symbols)
|
||||
self.cob_integration.add_dashboard_callback(self._on_cob_update)
|
||||
self.cob_integration.add_dashboard_callback(self._sync_cob_update_wrapper)
|
||||
|
||||
# Start COB data streaming as background task
|
||||
asyncio.create_task(self.cob_integration.start())
|
||||
@ -319,6 +319,14 @@ class COBDashboardServer:
|
||||
except Exception as e:
|
||||
logger.error(f"Error handling WebSocket message: {e}")
|
||||
|
||||
def _sync_cob_update_wrapper(self, symbol: str, data: Dict):
|
||||
"""Sync wrapper for async COB update handler"""
|
||||
try:
|
||||
# Create async task to handle the update
|
||||
asyncio.create_task(self._on_cob_update(symbol, data))
|
||||
except Exception as e:
|
||||
logger.error(f"Error in COB update wrapper for {symbol}: {e}")
|
||||
|
||||
async def _on_cob_update(self, symbol: str, data: Dict):
|
||||
"""Handle COB updates from integration"""
|
||||
try:
|
||||
@ -504,7 +512,7 @@ class COBDashboardServer:
|
||||
except Exception:
|
||||
self.websocket_connections.discard(ws)
|
||||
|
||||
await asyncio.sleep(5) # Update every 5 seconds
|
||||
await asyncio.sleep(1) # Update every 1 second for real-time responsiveness
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error in periodic stats update: {e}")
|
||||
|
Reference in New Issue
Block a user