Jacky Zhao
2024-08-09 195fc5134c41ea75161cab9af9ef135074754db5
fix: pass buildId to worker
2 files modified
10 ■■■■ changed files
quartz/processors/parse.ts 2 ●●● patch | view | raw | blame | history
quartz/worker.ts 8 ●●●● patch | view | raw | blame | history
quartz/processors/parse.ts
@@ -143,7 +143,7 @@
    const childPromises: WorkerPromise<ProcessedContent[]>[] = []
    for (const chunk of chunks(fps, CHUNK_SIZE)) {
      childPromises.push(pool.exec("parseFiles", [argv, chunk, ctx.allSlugs]))
      childPromises.push(pool.exec("parseFiles", [ctx.buildId, argv, chunk, ctx.allSlugs]))
    }
    const results: ProcessedContent[][] = await WorkerPromise.all(childPromises).catch((err) => {
quartz/worker.ts
@@ -7,8 +7,14 @@
import { options } from "./util/sourcemap"
// only called from worker thread
export async function parseFiles(argv: Argv, fps: FilePath[], allSlugs: FullSlug[]) {
export async function parseFiles(
  buildId: string,
  argv: Argv,
  fps: FilePath[],
  allSlugs: FullSlug[],
) {
  const ctx: BuildCtx = {
    buildId,
    cfg,
    argv,
    allSlugs,