mirror of
https://ghfast.top/https://github.com/aeroxw/tick-stock-panel.git
synced 2026-09-12 16:44:15 +08:00
Merge pull request #296 from kevin9327/fix/trading-day-unknown-verdict-cache
fix(trading-day): 「未知」结论也按 TTL 缓存, 不再每拍重打探测
This commit is contained in:
@@ -113,9 +113,11 @@ def is_trading_day(now: datetime | None = None) -> bool | None:
|
||||
return False
|
||||
|
||||
with _CACHE_LOCK:
|
||||
# 「未知」(None) 也是一个结论, 同样按 TTL 缓存 —— 它正是 _TTL_UNKNOWN_S 要
|
||||
# 挡住的场景 (未配 fuyao 且 tickflow 不可用时, 轮询每拍都会重打一次探测)。
|
||||
# _CACHE.day 只在探测写回时设置, 因此「当天已探过」用它判定即可。
|
||||
if (
|
||||
_CACHE.day == now.date()
|
||||
and _CACHE.verdict is not None
|
||||
and (time.monotonic() - _CACHE.probed_at) < _ttl_of(_CACHE.verdict)
|
||||
):
|
||||
return _CACHE.verdict
|
||||
|
||||
Reference in New Issue
Block a user