gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0d6293eb0d6293ebmission 043: mission filemre0d6293eb/lib/bootscan.hl

3.2 KB

  1. // lib/bootscan.hl — THE BOOT SCANS (tracker.worldapi.org#45, mission 043): ONE streamed pass per big table at start, feeding every
  2. // derived structure that needs that table, instead of one `find(null, null)` per module (each decoded the WHOLE table into one
  3. // array: persons 621 K rows 11 s and 5.6 GB, episodes 1.4 M rows 9 s and +3 GB, five times over; 54 % of the boot was the GC
  4. // pauses those arrays caused — missions/388-trkmem-report.md in the Hybriel repo). `iterate(null, null)` hands out one record at
  5. // a time and frees it.
  6. //
  7. // titles → catalog.hl (the public lists, genres) shows.hl (slug map) search.hl (title entries, TMDB / TVmaze ids, slugs)
  8. // shortids.hl (owners, queue) people.hl (cast photos)
  9. // episodes → catalog.hl (newest released / upcoming dates)
  10. // people → search.hl (person entries) shortids.hl people.hl (slug map, TMDB ids, /people's order)
  11. //
  12. // Every module keeps its own lazy build (ensureIndex, ensureShortIds, …) built from the SAME per-record functions used here, so a
  13. // tool that imports one module still works; project.hl calls bootScan() once before the first request. The order inside a table is
  14. // the table's, as with the old per-module scans (search entries, short id ownership and the id queue come out the same).
  15. import { now } from 'hl:time'
  16. import { showsTable, episodesTable, personsTable, noteSlugsOf, markSlugIdsBuilt } from './shows.hl'
  17. import { beginIndex, noteIndexShow, noteIndexEpisode, finishIndex } from './catalog.hl'
  18. import { indexShow, noteIndexPerson, finishSearchIndex } from './search.hl'
  19. import { loadOldShortIds, noteShortIdRow, finishShortIds } from './shortids.hl'
  20. import { noteCastProfiles, markPeopleIndexesBuilt, noteSlugOfPerson, noteTmdbOfPerson, viewEntryOf, finishPeopleView } from './people.hl'
  21. static scanned = { titles = 0 episodes = 0 people = 0 castPhotos = 0 ms = 0 }
  22. static scanTitles = () => {
  23. t0 = now()
  24. beginIndex()
  25. loadOldShortIds()
  26. let cast = 0
  27. for (s of showsTable.iterate(null, null)) {
  28. noteIndexShow(s)
  29. noteSlugsOf(s)
  30. indexShow(s)
  31. noteShortIdRow('show', s)
  32. cast = cast + noteCastProfiles(s)
  33. scanned.titles = scanned.titles + 1
  34. }
  35. scanned.castPhotos = cast
  36. markSlugIdsBuilt()
  37. console.log('boot scan: ' + scanned.titles + ' titles in ' + (now() - t0) + ' ms')
  38. return t0
  39. }
  40. static scanEpisodes = () => {
  41. t0 = now()
  42. for (e of episodesTable.iterate(null, null)) {
  43. noteIndexEpisode(e)
  44. scanned.episodes = scanned.episodes + 1
  45. }
  46. finishIndex()
  47. console.log('boot scan: ' + scanned.episodes + ' episodes in ' + (now() - t0) + ' ms')
  48. return true
  49. }
  50. static scanPeople = (&t0) => {
  51. t1 = now()
  52. let stored = []
  53. for (p of personsTable.iterate(null, null)) {
  54. noteIndexPerson(p)
  55. noteShortIdRow('person', p)
  56. noteSlugOfPerson(p)
  57. noteTmdbOfPerson(p)
  58. stored.push(viewEntryOf(p))
  59. scanned.people = scanned.people + 1
  60. }
  61. finishSearchIndex(t0)
  62. finishShortIds(t0)
  63. markPeopleIndexesBuilt(scanned.castPhotos)
  64. finishPeopleView(stored)
  65. console.log('boot scan: ' + scanned.people + ' people in ' + (now() - t1) + ' ms')
  66. return true
  67. }
  68. static bootScan = () => {
  69. t0 = scanTitles()
  70. scanEpisodes()
  71. scanPeople(t0)
  72. scanned.ms = now() - t0
  73. console.log('boot scan: done in ' + scanned.ms + ' ms')
  74. return scanned
  75. }

Branches

Latest commits

  • 0d6293ebmission 043: mission filemre
  • 55bbd619boot: one streamed pass per table (lib/bootscan.hl) instead of find(null,null) per module; follows/watches/franchises scans streammre
  • 1d465d3ere-vendor plugins to Hybriel master f9614007 (mpackdb #202 copy fix, libmpackdb sha 6fb3b9d6)mre
  • 6648ba44mission 042: real-browser E2E on ce6f2e0a re-vendor 69/0 at 390 + 1280mre
  • 3ed3a0efmission 042: gates old/new equal (browser #41 route-table regex accepts unescaped hl:web output), real-data TTFB, E2E blocked by lisbeth lockmre
  • d5b61e90LOG 042mre
  • 4acdbaccmission 042: memory comparison old vs ce6f2e0a (stopped: warm VmHWM higher), reportmre
  • d0f620d6mission 042: re-vendor Hybriel ce6f2e0a (plugins incl. mpackdb; bin runtime built from the same archive, git-ignored), compact=false keptmre
  • 5bd14e12mission 040: theme 76f99f6 gates + E2E green; 44 px fixes (skeleton row, type-word, genre-link/pill); README, reportmre
  • 77cfa45cmission 040: partial report (theme/modal/pagination re-copied, tilelist onPage, 44 px taps; gates new + E2E pending)mre
  • 4b14822fe2e-theme: menu marker by colourmre
  • 09780f4emission 040 WIP: theme, modal, pagination, tokens re-copied from layouts 76f99f6; tilelist uses onPage; tap sizes 44 px for tracker's own small buttons; tests/e2e-theme.mjsmre
  • fb80bb8chotfix: open the 5 show stores without compaction (compact = false) — compact-on-open left another handle on stale offsets, every read gave a bare Number (hybriel mpackdb refresh after a shrink); live down 2026-10-20 05:11mre
  • e00d3bf7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • a8c7f234tracker#36 (mission 039): tools/tmdb-check.hl survives a dropped connection (on Error, asked again, failed lines) and resumes with --from N; tests/tmdbcheck.mjs 6/6 against a fake TMDBmre
  • 9c230516mission brief w39mre
  • 3609121dmission 038 docs + report (quota stop): README/kinds.md for #43 #42 #36, STATUS, LOG; HEAD browser gate 374/8 in the in-app daily run block (hour-boundary suspected, rerun pending), other gates green; #36 real run needs TMDB_READ_TOKENmre
  • a5d06e79tracker#36 (mission 038): tools/tmdb-check.hl + lib/tmdbcheck.hl — every live migrated title's migrated title + year against its TMDB entry (one GET /movie|tv/<id>?append_to_response=alternative_titles, 260 ms apart, passing failures asked once more): ok / ambiguous (one of title, year disagrees) / clear (both, or 404); read-only; token only from TMDB_READ_TOKEN; --stored = a title-only preview from the TMDB names already stored (no request). Tested against a fake TMDB (.scratch/w38/t36): 7 titles, 3 ok, 2 ambiguous, 2 clear, data unchangedmre
  • 982554f3tracker#42 (mission 038): series pages — an unknown slug no longer scans every title (lib/shows.hl showBySlug: the slug map only; new titles are noted by refreshTitleCaches, which both title puts already reach): 10.7–15.7 s → 0.013 s on the real copy (the one-request-at-a-time server was blocked meanwhile); cast/crew rows take name + slug from a person-link cache (personLinkOf) instead of whole person records (SNL: 303 cast with 4,761 credits, ~49k allocations per render) — allocations per series page −5…−40 %; HTML of 20 pages identical to beforemre
  • 4586b6e3docker-compose: init: true (hybriel#156)mre