perf: optimize system concurrency, I/O stability and fix WebSocket disconnects
This commit is contained in:
@@ -144,7 +144,7 @@ class TradingPipeline:
|
||||
self._team_controller = DynamicTeamController(
|
||||
create_callback=self._create_runtime_analyst,
|
||||
remove_callback=self._remove_runtime_analyst,
|
||||
get_analysts_callback=self._all_analysts,
|
||||
get_analysts_callback=lambda: self._all_analysts() + [self.risk_manager, self.pm],
|
||||
)
|
||||
set_controller(self._team_controller)
|
||||
|
||||
|
||||
@@ -123,7 +123,11 @@ class StateSync:
|
||||
# Persist to feed_history
|
||||
if persist:
|
||||
self.storage.add_feed_message(self._state, event)
|
||||
self.save_state()
|
||||
# Make persistence non-blocking to keep event loop snappy
|
||||
if asyncio.get_event_loop().is_running():
|
||||
asyncio.create_task(asyncio.to_thread(self.save_state))
|
||||
else:
|
||||
self.save_state()
|
||||
|
||||
# Broadcast to frontend
|
||||
if self._broadcast_fn:
|
||||
|
||||
Reference in New Issue
Block a user