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
+5
View File
@@ -26,6 +26,11 @@ _OKX_OPTION_ERR_ZH: dict[str, str] = {
_OPTIONS_BALANCE_CACHE: dict[str, Any] = {"updated_at": 0.0, "data": None}
def invalidate_options_balance_cache() -> None:
_OPTIONS_BALANCE_CACHE["updated_at"] = 0.0
_OPTIONS_BALANCE_CACHE["data"] = None
def _okx_trade_error_message(exc: BaseException | None = None, resp: Any = None) -> str:
row: dict[str, Any] | None = None
if isinstance(resp, dict):