修复粉尘桥拦开仓,并继续消除模拟盘嵌套握锁导致的 database is locked。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-07 11:28:29 +08:00
parent 030b237981
commit ea3e029eb9
7 changed files with 196 additions and 33 deletions
+3
View File
@@ -390,6 +390,8 @@ def run_options_target_closes(
mark_monitor(conn, int(mon["id"]), status="expired", message="持仓已平")
_commit_monitor(conn)
continue
# 平仓/卖币另开连接,先提交释放锁
_commit_monitor(conn)
result = close_fn(inst_id)
idx = _safe_float(pos_by_inst[inst_id].get("idx_px") or pos_by_inst[inst_id].get("idxPx"))
if result.get("already_flat") or _result_fully_done(result):
@@ -432,6 +434,7 @@ def run_options_target_closes(
if not target_hit(opt_type=str(opt_type) if opt_type else None, index_px=idx, target_index=target):
continue
_commit_monitor(conn)
result = close_fn(inst_id)
if result.get("already_flat"):
mark_monitor(conn, int(mon["id"]), status="expired", trigger_idx=idx, message="持仓已平")