gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit1a5a48181a5a4818boot scans back to iterate (slices measured slower: titles 114 s, episodes 141 s, persons failed); lambda per rowmre1a5a4818/lib/bootscan.hl

4.1 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 the rows out one at a
  5. // time and frees each (but see eachRow: the plugin decodes the file into one native arena first).
  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. // every row of a table, one at a time (`iterate`). NOTE (mission 043, measured): the plugin's find_all decodes the whole file into
  23. // ONE native arena before the first row, so the PEAK is still the table's decoded size, freed after the pass. The primary-key SLICES of
  24. // mission 044 (slices.hl, `range('id', lo, hi)`) were tried here: on the copy they made the title pass 114 s and the episode pass 141 s
  25. // (iterate: 31 s / 30 s) and the person pass failed with "reading 'id': the value is Number" (slices.hl:40) — not used; see the report.
  26. static eachRow = (table, each) => {
  27. let n = 0
  28. for (r of table.iterate(null, null)) {
  29. each(r)
  30. n = n + 1
  31. }
  32. return n
  33. }
  34. static scanTitles = () => {
  35. t0 = now()
  36. beginIndex()
  37. loadOldShortIds()
  38. eachRow(showsTable, (&s) => {
  39. noteIndexShow(s)
  40. noteSlugsOf(s)
  41. indexShow(s)
  42. noteShortIdRow('show', s)
  43. scanned.castPhotos = scanned.castPhotos + noteCastProfiles(s)
  44. scanned.titles = scanned.titles + 1
  45. return null
  46. })
  47. markSlugIdsBuilt()
  48. console.log('boot scan: ' + scanned.titles + ' titles in ' + (now() - t0) + ' ms')
  49. return t0
  50. }
  51. static scanEpisodes = () => {
  52. t0 = now()
  53. eachRow(episodesTable, (&e) => {
  54. noteIndexEpisode(e)
  55. scanned.episodes = scanned.episodes + 1
  56. return null
  57. })
  58. finishIndex()
  59. console.log('boot scan: ' + scanned.episodes + ' episodes in ' + (now() - t0) + ' ms')
  60. return true
  61. }
  62. static peopleStored = []
  63. static scanPeople = (&t0) => {
  64. t1 = now()
  65. eachRow(personsTable, (&p) => {
  66. noteIndexPerson(p)
  67. noteShortIdRow('person', p)
  68. noteSlugOfPerson(p)
  69. noteTmdbOfPerson(p)
  70. peopleStored.push(viewEntryOf(p))
  71. scanned.people = scanned.people + 1
  72. return null
  73. })
  74. markPeopleIndexesBuilt(scanned.castPhotos)
  75. finishSearchIndex(t0)
  76. finishShortIds(t0)
  77. finishPeopleView(peopleStored)
  78. console.log('boot scan: ' + scanned.people + ' people in ' + (now() - t1) + ' ms')
  79. // tracker#37's log line (tests/browser.mjs reads it)
  80. console.log('people view: ' + scanned.people + ' people, ' + scanned.castPhotos + ' cast photos in ' + (now() - t1) + ' ms')
  81. return true
  82. }
  83. static bootScan = () => {
  84. t0 = scanTitles()
  85. scanEpisodes()
  86. scanPeople(t0)
  87. scanned.ms = now() - t0
  88. console.log('boot scan: done in ' + scanned.ms + ' ms')
  89. return scanned
  90. }

Branches

Latest commits

  • 1a5a4818boot scans back to iterate (slices measured slower: titles 114 s, episodes 141 s, persons failed); lambda per rowmre
  • 03d29893boot scans read primary-key slices (lib/slices.hl from mission 044): iterate is eager too; people view log line back; allShows/allEpisodes stay for toolsmre
  • 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