Parallelize build-time meta-image rendering with worker threads#20105
Conversation
Extract the card templates and Satori/resvg rendering from generate-meta-images.mjs into scripts/meta-images/render.mjs so the generator and a new worker_threads entry (render-worker.mjs) share one definition. Cold runs (fresh checkout or OG_TEMPLATE_VERSION bump) fan out across a worker pool sized to the machine; small incremental batches (< 8 cards) or OG_WORKERS=1 render inline to skip worker startup. No visual change — the moved template code is byte-identical. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Your site preview for commit 121fe14 is ready! 🎉 http://www-testing-pulumi-docs-origin-pr-20105-121fe142.s3-website.us-west-2.amazonaws.com |
Pre-merge Review — Last updated 2026-07-07T14:56:25ZTip Summary: Build-tooling change (no reader-facing content): the meta-image generator is refactored to render social cards in parallel. The pure card-rendering templates move into a new shared Review confidence:
Investigation log
🔍 Verification trail1 claims extracted · 0 verified · 0 unverifiable · 0 contradicted
🚨 Outstanding in this PRNo outstanding findings in this PR.
|
Two robustness fixes to the build-time card generator: - renderPool: add a worker `exit` handler so a worker that dies without emitting `error` (non-zero exit — OOM, native resvg crash) still settles its in-flight job instead of dangling it and hanging the build. Shared failure logic is factored into failWorker (idempotent per worker via the `live` guard), and a `done` flag stops the pool's own terminate()-driven exits from being counted as spurious failures. - Fail the build on a total render wipeout by comparing failures against todo (what was attempted this run), not pages (all cards). With a warm cache most pages are cached, so the old pages.length check could never fire on an incremental run — a systemic render break would ship green with missing cards. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cnunciato
left a comment
There was a problem hiding this comment.
Claude had a few suggestions that seem reasonable, so pushed a commit to cover those. Nice work!
Proposed changes
Extracts the social-card templates and Satori/resvg rendering from
scripts/generate-meta-images.mjsintoscripts/meta-images/render.mjs, shared by the generator and a newworker_threadsentry (scripts/meta-images/render-worker.mjs). Cold runs — a fresh checkout or anOG_TEMPLATE_VERSIONbump, where every card re-renders — now fan out across a worker pool sized to the machine's cores (override withOG_WORKERS). Small incremental batches (fewer than 8 cards, the common case) andOG_WORKERS=1still render inline, skipping worker startup. The moved template code is byte-identical, so cache keys and rendered output are unchanged; verified both paths locally (0 failures).Unreleased product version (optional)
n/a
Related issues (optional)
n/a