This page is The phone chat-index loop was wedged. Now a tick takes 4 seconds.. It is one of the projects Brandon built and put online. The grown-up details are below, tap Grown-up mode to read them the normal way.
drwu-htmls ยท infra fix ยท 2026-06-07
The 5-min com.drwu.phone-chat-index job re-renamed and re-tagged all ~1,200 chats on every tick, so a 20-minute job could never fit a 5-minute window. It fell permanently behind and froze the live /chats board.
tag_chats_categories.py opened the transcript of every chat on every tick to read its first message. ~1,200 file reads, every 5 minutes.rename_chats_caps.py stripped the leading <TAG> off each title and rewrote the bare form; tag_chats_categories.py then re-added the tag. So every tick rewrote ~1,180 titles twice and wrote a ~200 KB backup โ for zero net change. That is the "applied 1183 renames" seen on every run._state/rename_chats_state.json, _state/tag_chats_state.json) mapping cid โ [mtime_ns, size] of its transcript.if plan:), never on an idle tick.One warm-up tick populates the cache (one-time). After that, only live sessions whose transcripts are still being written get re-titled โ exactly the chats that should update. An idle tick does zero work and writes no backup.
| Metric | Before | After |
|---|---|---|
| Full refresh_phone_chat_index.sh tick | ~20+ min (overran 300s) | 4.07 s |
| rename_chats_caps.py (steady) | ~all 1,183 rewritten | 0.82 s ยท 0โ4 rewritten |
| tag_chats_categories.py (steady) | reads all ~1,200 transcripts | 0.85 s ยท skips unchanged |
| Transcripts read per tick | ~1,200 | only changed ones |
| ~200 KB backup per tick | always (ร2) | only on real change |
| Loop vs 300s interval | wedged / behind | fits in <5 s |
~/scripts/rename_chats_caps.py โ incremental skip on transcript signature; backup only on change.~/scripts/tag_chats_categories.py โ incremental skip on signature + title; backup only on change.~/scripts/_state/rename_chats_state.json, ~/scripts/_state/tag_chats_state.json.refresh_phone_chat_index.sh or the launchd plist โ same 300s interval, now it actually fits.