Fix server hang: stop CTP reconnect storm and throttle live account polling.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-03 21:24:30 +08:00
parent d6776d2b8e
commit 9508d88938
5 changed files with 38 additions and 18 deletions
+6
View File
@@ -45,6 +45,12 @@ class PositionStreamHub:
with self._lock:
return dict(self._snapshot) if self._snapshot else None
def snapshot_age_sec(self) -> float:
with self._lock:
if not self._snapshot_ts:
return 9999.0
return max(0.0, time.time() - self._snapshot_ts)
def set_snapshot(self, data: dict) -> None:
with self._lock:
self._snapshot = dict(data)