gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit613ae0ec613ae0ecMerge branch 'bs3' into mainTracker613ae0ec/lib/warm.hl

2.1 KB

  1. // lib/warm.hl — THE START-UP STATE (mission T17, boot time): the server listens BEFORE the derived structures (public lists, slug maps,
  2. // search index, short ids, people view) are built; bootscan.hl builds them in time-boxed steps between requests. This is the one
  3. // place that says how far it is. `running` = a progressive start is under way (a module's lazy full-scan fallback must NOT run
  4. // then — it would block the server for minutes); the three flags turn true one after the other:
  5. // titles → the slug map (shows.hl), the titles' own derived data are in
  6. // catalog → titles + episodes: the public lists, the genre lists, the newest-episode dates (catalog.hl)
  7. // people → everything: search index, short ids (owners), person slug / TMDB maps, /people's order; the jobs start
  8. // A tool or a test that never starts the progressive scan has running = false: the modules' lazy builds work as before.
  9. import { now } from 'hl:time'
  10. import { Response } from 'hl:http1'
  11. static warm = { running = false titles = false catalog = false people = false phase = '' rows = 0 startedAt = 0 readyAt = 0 }
  12. static warmRunning = () => { return warm.running }
  13. // what a page that needs `level` ('titles' | 'catalog' | 'all') may do: true = go ahead
  14. static warmReady = (level) => {
  15. if (!warm.running) { return true }
  16. if (level == 'titles') { return warm.titles }
  17. if (level == 'catalog') { return warm.catalog }
  18. return warm.people
  19. }
  20. // the writers that rely on the complete indexes (a duplicate title / person / short id otherwise) refuse until all is built
  21. static warmBlocked = () => { return warm.running && !warm.people }
  22. static warmSeconds = () => {
  23. if (warm.startedAt == 0) { return 0 }
  24. s = (now() - warm.startedAt) / 1000
  25. return s - s % 1
  26. }
  27. static warmText = () => {
  28. return 'tracker is starting up: the lists, the search and the people are being built (' + warm.phase + ', ' + warmSeconds() + ' s so far). Reload this page in a minute or two.'
  29. }
  30. static startingUpText = () => { return new Response('tracker is starting up, try again in a minute', { status = 503 headers = { 'Retry-After' = '30' 'Content-Type' = 'text/plain; charset=utf-8' 'X-Content-Type-Options' = 'nosniff' } }) }

Branches

Latest commits

  • 613ae0ecMerge branch 'bs3' into mainTracker
  • 1383264b|||PR BS3: keep shared synchronous sorting fastTracker
  • 63e5ba1a|||PR BS3: guard boot imports and share resumable sort buffersTracker
  • 310613f1Merge branch 'records-dp72' into mainTracker
  • 6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker
  • c41587d2Merge branch 'bs2' into mainTracker
  • 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
  • 019d5cedMerge branch 'records-1110' into mainTracker
  • f88ae8b9|||PR records: day56 toggle live, reviewTracker
  • b6b3bb4dMerge branch 'ap56e' into mainTracker
  • 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
  • 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
  • 4b54f6f9Merge branch 'records-audit' into mainTracker
  • cab4a3bc|||PR records: branch audit, PR-onlyTracker
  • 641e1c4cMerge branch 'records-dp71' into mainTracker
  • 85a6e9f5|||PR records: DP71 checked in ChromeTracker
  • f5be5f18records: gitoria PR-only planTracker
  • 46a37036records: DP71 liveTracker
  • 3bcb7039Status/log: DP71 in progressTracker
  • 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker