个人长报告同盘同日重试改为秒回
完整数据版在版本号明确时复用当天的结果。渲染快捷算法留下但默认关闭,本机只快了大约两成。 Co-Authored-By: Grok (agent loop)
This commit is contained in:
co-authored by
Grok (agent loop)
parent
66cd60081f
commit
69c739fbee
@@ -0,0 +1,40 @@
|
||||
"""Call-time switches for long-report rendering and same-chart reuse.
|
||||
|
||||
Values are read on every call so one process can measure the old path and the
|
||||
new path back to back. The old path stays in place when a switch is off.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
# Masked Windows A/B on 2026-10-14. Render shortcuts are byte-identical and use
|
||||
# less memory, but the end-to-end drop was 20–23%, short of the 35% gate, so
|
||||
# the fast path stays off. Cache hits matched the miss bytes and returned in
|
||||
# about 0.06s, under the 1.5s gate. A missing or unknown GITHUB_SHA still
|
||||
# disables the cache at the call site.
|
||||
RENDER_FAST_DEFAULT = False
|
||||
REFERENCE_CACHE_DEFAULT = True
|
||||
|
||||
_ON = {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
def _enabled(name: str, default: bool) -> bool:
|
||||
raw = os.environ.get(name)
|
||||
if raw is None or not raw.strip():
|
||||
return default
|
||||
return raw.strip().lower() in _ON
|
||||
|
||||
|
||||
def report_render_fast_enabled() -> bool:
|
||||
"""True when the equivalent render and hash shortcuts may run."""
|
||||
return _enabled("JYOTISH_REPORT_RENDER_FAST", RENDER_FAST_DEFAULT)
|
||||
|
||||
|
||||
def report_reference_cache_enabled() -> bool:
|
||||
"""True when a full_data markdown response may be reused from disk.
|
||||
|
||||
A missing or ``unknown`` ``GITHUB_SHA`` still disables the cache at the
|
||||
call site. This function only reads the switch.
|
||||
"""
|
||||
return _enabled("JYOTISH_REPORT_REFERENCE_CACHE", REFERENCE_CACHE_DEFAULT)
|
||||
Reference in New Issue
Block a user