chore: 移除温区缓存临时调试日志(验证完毕)
This commit is contained in:
@@ -52,8 +52,6 @@ def _compute_regime_winrates_cached(pt, _approx_univ):
|
||||
from flask import request as _req
|
||||
|
||||
# 缓存键
|
||||
import time as _tt
|
||||
_t0 = _tt.time()
|
||||
_cache_key = None
|
||||
try:
|
||||
_cc = _sq.connect(str(DATA_DIR / "mofin.db"), timeout=5)
|
||||
@@ -61,14 +59,11 @@ def _compute_regime_winrates_cached(pt, _approx_univ):
|
||||
_cc.close()
|
||||
_cache_key = (pt or "2y") + "|" + str(_ver_s)
|
||||
except Exception as _e:
|
||||
print(f"[REGIME_CACHE] key_err: {_e}", flush=True)
|
||||
_cache_key = None
|
||||
_slots = _regime_winrates_cache.get("slots") or {}
|
||||
_slot = _slots.get(pt or "2y")
|
||||
if _cache_key and _slot and _slot[0] == _cache_key:
|
||||
print(f"[REGIME_CACHE] HIT pt={pt} cost={round(_tt.time()-_t0,3)}s", flush=True)
|
||||
return _slot[1]
|
||||
print(f"[REGIME_CACHE] MISS pt={pt} key={_cache_key} slots={list(_slots.keys())}", flush=True)
|
||||
|
||||
_pt_chain = {'1m': '1y', '6m': '1y', '1y': '1y', '2y': '2y', '5y': '5y', '10y': '10y'}
|
||||
_pt_use = _pt_chain.get(pt or '2y', '2y')
|
||||
@@ -177,7 +172,6 @@ def _compute_regime_winrates_cached(pt, _approx_univ):
|
||||
(_regime_winrates_cache.setdefault("slots", {}))[pt or "2y"] = (_cache_key, _regime_winrates)
|
||||
except Exception:
|
||||
pass
|
||||
print(f"[REGIME_CACHE] DONE pt={pt} cost={round(_tt.time()-_t0,1)}s strategies={len(_regime_winrates)}", flush=True)
|
||||
return _regime_winrates
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user