-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprewarm_cache.py
More file actions
35 lines (25 loc) · 1.15 KB
/
Copy pathprewarm_cache.py
File metadata and controls
35 lines (25 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Prewarm the rift cart's parse + embed caches after a corpus change.
Spawned detached by the bird-repo git hooks (install_hooks.py) so the running
rift-verify server's next dirty-marker refresh is instant: by the time anyone calls
verify_statement, changed files are already re-parsed and new chunks already embedded.
Safe to run any time; cost scales with the diff (content-keyed caches). Progress goes to
stderr per the estate stdio rule.
Run: .venv/Scripts/python.exe prewarm_cache.py
"""
from __future__ import annotations
import sys
import time
def main() -> int:
t = time.time()
import index_cache
from checker import JudgeChecker
from runtime_verify import TypedChecker
typed = TypedChecker() # parses headers + impls (cached)
JudgeChecker() # embeds any new chunks (cached)
print(f"prewarm done in {time.time() - t:.1f}s — "
f"{index_cache.last_stats['parsed']} file(s) re-parsed, "
f"{len(typed.idx)} classes, {len(typed.calls)} implementations",
file=sys.stderr, flush=True)
return 0
if __name__ == "__main__":
raise SystemExit(main())