Force-refresh header balances after transfers and balance SSE events.

Invalidate balance caches on mutation, push SSE balance tick, and bypass 60s cache when refreshing funds.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-12 09:03:15 +08:00
parent bb53beb22d
commit 5eb9b9f5c5
10 changed files with 63 additions and 13 deletions
+11
View File
@@ -2526,6 +2526,10 @@ def friendly_okx_error(err, available_usdt=None):
friendly_exchange_error = friendly_okx_error
def invalidate_account_balance_cache() -> None:
ACCOUNT_BALANCE_CACHE["updated_at"] = 0
def get_exchange_capitals(force=False):
ok_live, _ = ensure_okx_live_ready()
if not ok_live:
@@ -9286,6 +9290,13 @@ def manual_transfer():
conn.commit()
conn.close()
if ok:
invalidate_account_balance_cache()
try:
from lib.instance.instance_live_push_lib import notify_instance_balance_changed
notify_instance_balance_changed()
except Exception:
pass
flash(f"手动划转成功:{amount}U {from_account}->{to_account}")
else:
flash(f"手动划转失败:{msg}")