Repository navigation
perf(stats): serve 5chan stats on their own and keep threads only for popular boards - #47
Conversation
… popular boards The 5chan home page's Stats box can read GET /api/v1/5chan/stats, the boards without their threads (8 KB gzipped instead of 180 KB). The boards document keeps threads only for the 20 worksafe and 20 NSFW boards whose threads score highest, which still covers the 16-board pool the Popular Threads box picks from under each content filter, and drops to about 125 KB gzipped. The monitor now records each board's safeForWork from its directory so the server can rank the two groups apart.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
The 5chan home page downloads the whole boards document (180 KB gzipped) before either of its boxes can render. On a slow path to Cloudflare that download alone took 1.3–5 s, and past 5 s 5chan gives up and loads the boards over P2P instead (9–15 s).
GET /api/v1/5chan/stats: the same boards withoutthreads, about 8 KB gzipped, for the Stats box.GET /api/v1/5chan/boards: threads only for the 20 worksafe and 20 NSFW boards whose threads score highest; every other board keeps its stats withthreads: []. 5chan picks from the threads of the 16 most popular boards it shows, and its content filter shows worksafe boards (the default), NSFW boards or both, so each group's top 20 covers every choice. On the live data this is about 125 KB gzipped (33 of 63 boards keep a thread).features.safeForWorkand writes it per board (nullwhen undeclared), so the server can rank the two groups apart. The monitor's file is unchanged otherwise; it still holds every board's thread, which it reads back after a restart.Both endpoints share the boards caching (
max-age=60, Cloudflarestale-while-revalidate=600), and the existing Cloudflare cache rule already covers/api/v1/5chan/.5chan's client change lands in bitsocialnet/5chan#1265, which reads
/statsfor the Stats box. This needs to deploy first.Verification:
yarn workspace @bitsocial/stats-web test(29 pass), monitornode --test(33 pass),yarn lint(no new warnings),yarn build:stats-web.Summary by CodeRabbit
GET /api/v1/5chan/statsendpoint, providing board statistics without thread data.