tracker
All repositories: gitoria
2.5 KB
# 044 — the background jobs run in slices (tracker.worldapi.org ticket 45, part 2 of the trkmem fix)Cause (Hybriel mission 388, trkmem): after the server listens, the background jobs rescan whole tables with `find(null, null)`(merge 74 s, adult backfill 28.5 s, details repair 19.3 s …): every scan decodes ALL rows into one array and the single-threadedserver serves no page meanwhile (loads of 19–28 s).Finding while doing it: `iterate(null, null)` is NOT streaming either — plugins/mpackdb/mpackdb.zig `find_all` reads and decodes thewhole file into one native arena in ONE call (then hands rows out one by one). So "stream instead of find" would still block forthe whole decode. The slice therefore has to be a different query: a primary-key RANGE (`range('id', from, to)`, engine`findRangeLocs`: searches the in-RAM pk index, reads only that range's rows).Work (branch w44-jobs-slices, Hybriel only, no plugin edit):1. lib/slices.hl: 256 slices by the first two hex digits of the id (ids are 16 hex chars; the bounds are inclusive, a row whose keyequals the upper bound is left to the next slice, so the slices partition ANY key set exactly); `collectStart/collectStep/collected`collect only the ids a job needs, taking slices until `TRACKER_SLICE_MS` (30 ms) is spent per timer tick.2. adult / kind / tvmaze-status / art / credits / details-repair queues (backfill.hl, credits.hl, details.hl + jobs.hl ticks): scan byslices on the 0.1 s tick; the start log line now reads "(N ms to find them, M ms of scanning in slices)".3. merge prepare (merge.hl): a phase machine over shows → watches → seasons → episodes → follows → persons, same maps/queue, the workingmaps released at the end; `mergePrepare()` answers false until built (jobs.hl mergeTick, mergeStep).4. collections prepare (collections.hl `seedPrepare`): checks table and shows by slices (timelines: a few hundred rows, one `find`).5. check: tests/jobs-dump.hl (new) + the old tree's twin through the former functions, on tests/seed-bulk.hl (≈2.9 K shows spread overall slices, duplicate groups, strays, doubled episodes, 3 non-hex ids): sorted outputs equal incl. every table after all merge steps.6. tests/slices-bench.hl: longest tick of a sliced scan vs the one block of the old scan on a big store.7. The 5 gates + check-theme.Not changed (other owner / small): lib/people.hl photoQueue (boot-path file of worker T9: 621 K `personsTable.fetch` in ONE tick —see the report), follows/watches/franchises/timelines scans (small tables, user tables), dailysync.hl moveCopiedSummaries (runs once ever).
Branches
Latest commits
- 8d3b0f20widget: the franchise link's 44 px tap area no longer overlaps the Prequel/Sequel rowmre
- 1d98dcfdbrowser gate: the badges' size check reads the padding box (the 44 px tap area is transparent border)mre
- 2f9e29ffreports/MK-mobile.md, deploy.sh GATES: tests/mobile.mjs, theme check markermre
- 7cfc8ab5a season of more than 150 episodes starts closed on its title page; the phone gate checks itmre
- 59095c59tests/mobile.mjs: the phone gate (390 px touch, tap targets, /franchises paging)mre
- 105309detap targets: every row link, the TMDB/IMDb badges, the widget links, the franchise names and the login-failed link are 44 px high on a phonemre
- f0b86c8efranchises: 40 loose timelines per page (/franchises/page/N) and a merge sort for the names (1,546 timelines: 20 s and 54,000 px before)mre
- b9e841a7Merge branch 'sy-sync'mre
- d1ae2701sync components.hybriel 4922f9c: modal and pagination 44 px targets (vendored copies, verbatim) (SY)mre
- 043624b2theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
- 05d89fd0deploy: security gate (tests/security.mjs)mre
- 2ae8a47bMerge branch 'sk-sec'mre
- 8fee5d52sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- 944ad51eSK: report reports/SK-sec.md, LOGsk
- 415487c1SK: import budget per user + id type check, gate checkssk
- 7b8a4f74security audit SK: nosniff + image sandbox headers, face id checks, adult follow, login budget + new session at login, guest-link budget, tests/security.mjssk
- f0f26c5areports: T18 section (gates, boot-gate, 3x3 table, search + short-id compare)mre
- 2a8682a1deploy.sh GATES: tests/warmstart.mjsmre
- 3761338breports/T17-boot.md: handoff (phase table, fix, numbers so far, open proof)mre
- 52e09eb2boot: sync window 1000 ms (the gates ask for a complete start), README boot-time sectionmre