fix: avoid Binance /trade hang when exchange API is unreachable.
Add a short ccxt timeout and isolate orphan live-position loading so page render can fail soft. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -483,6 +483,7 @@ app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
|
||||
# Binance USDT 本位永续(ccxt unified: defaultType=swap)
|
||||
exchange = ccxt.binance({
|
||||
"enableRateLimit": True,
|
||||
"timeout": 5000,
|
||||
"options": {
|
||||
"defaultType": "swap",
|
||||
"defaultMarginMode": _BINANCE_DEFAULT_MARGIN_MODE,
|
||||
@@ -7315,7 +7316,10 @@ def render_main_page(page="trade", embed_mode=None):
|
||||
)
|
||||
orphan_live_positions = []
|
||||
if plan.orphan_live and not order_list and exchange_private_api_configured():
|
||||
orphan_live_positions = list_orphan_live_positions(conn)
|
||||
try:
|
||||
orphan_live_positions = list_orphan_live_positions(conn)
|
||||
except Exception:
|
||||
orphan_live_positions = []
|
||||
conn.close()
|
||||
from lib.instance.instance_embed_lib import embed_context_extras
|
||||
from lib.instance.instance_settings_lib import settings_page_context
|
||||
|
||||
Reference in New Issue
Block a user