修复监控握锁卖币导致中控快照超时、实例全部离线。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-07 10:56:40 +08:00
parent 265317672c
commit 066c90fd96
2 changed files with 30 additions and 16 deletions
+3 -11
View File
@@ -459,9 +459,9 @@ def _sync_options_trades(
finally:
conn.close()
try:
from lib.options.options_coin_open_lib import sweep_spot_after_options_flat
from lib.options.options_monitor_lib import sell_spot_after_options_sync
sweep_spot_after_options_flat(cfg, ex)
sell_spot_after_options_sync(cfg)
_mark_balances_stale(cfg)
except Exception:
pass
@@ -1991,20 +1991,12 @@ def _start_monitor_thread(app: Flask, cfg: dict[str, Any]) -> None:
return 0
live_ids = {str(p.get("instId") or "") for p in raw if str(p.get("instId") or "")}
reconcile_live_open_trades(conn, live_inst_ids=live_ids)
n = sync_open_options_trades(
return sync_open_options_trades(
conn,
live_inst_ids=live_ids,
fetch_history_fn=lambda inst_id: fetch_option_position_history(ex, inst_id),
notify_cfg=cfg,
)
try:
from lib.options.options_coin_open_lib import sweep_spot_after_options_flat
sweep_spot_after_options_flat(cfg, ex)
_mark_balances_stale(cfg)
except Exception:
pass
return n
def _target_close(inst_id: str) -> dict[str, Any]:
from lib.options.options_target_lib import close_option_by_bid_depth