fix: avoid SQLite lock on fast position poll by skipping DB writes

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 15:14:22 +08:00
parent 12a30d4f0c
commit c302e1f3ca
3 changed files with 34 additions and 7 deletions
+5 -4
View File
@@ -606,12 +606,13 @@ def check_monitors_locally(
if not is_trading_session():
return 0
reconcile_monitors_without_position(conn, mode)
conn.commit()
closed = 0
rows = conn.execute(
rows = [dict(r) for r in conn.execute(
"SELECT * FROM trade_order_monitors WHERE status='active'"
).fetchall()
for r in rows:
mon = dict(r)
).fetchall()]
conn.commit()
for mon in rows:
mid = int(mon.get("id") or 0)
sym = (mon.get("symbol") or "").strip()
direction = (mon.get("direction") or "long").strip().lower()