Fix positions and records pages hanging on load.

Stop blocking page render on full trading live rebuild and CTP trade sync; use cached snapshot and background prime instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-30 23:31:13 +08:00
parent 1b3a7f1bdc
commit 39eac983ff
2 changed files with 32 additions and 29 deletions
-15
View File
@@ -1442,21 +1442,6 @@ def records():
conn = get_db()
ctp_sync_info = None
try:
from ctp_trade_sync import sync_trade_logs_from_ctp
from trading_context import get_account_capital, get_trading_mode
from vnpy_bridge import ctp_status
mode = get_trading_mode(get_setting)
if ctp_status(mode).get("connected"):
capital = get_account_capital(conn, get_setting)
ctp_sync_info = sync_trade_logs_from_ctp(
conn, mode, capital=capital, trading_mode=mode,
)
conn.commit()
except Exception as exc:
app.logger.warning("ctp trade sync on records page: %s", exc)
sql = "SELECT * FROM review_records WHERE 1=1"
params: list = []
if start: