From 4ea985a2d7bd4c402b7349afe17d5c48c1bd4bbf Mon Sep 17 00:00:00 2001 From: frzyc Date: Sun, 26 Jan 2025 12:36:56 -0500 Subject: [PATCH] ZO minor fixes --- libs/sr/solver/src/parentWorker.ts | 12 +++++++++++- libs/zzz/page-optimize/src/WorkerSelector.tsx | 4 +++- libs/zzz/solver/src/parentWorker.ts | 12 +++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/libs/sr/solver/src/parentWorker.ts b/libs/sr/solver/src/parentWorker.ts index 9ba86e895a..8ad301f5b6 100644 --- a/libs/sr/solver/src/parentWorker.ts +++ b/libs/sr/solver/src/parentWorker.ts @@ -134,9 +134,19 @@ async function start({ type: 'module', }) ) - // Wait for all workers to finish optimizing + let results: BuildResult[] = [] let numBuildsComputed = 0 + + // post initial progress + postMessage({ + resultType: 'progress', + progress: { + numBuildsKept: 0, + numBuildsComputed: 0, + }, + }) + // Wait for all workers to finish optimizing await Promise.all( workers.map((worker, index) => { return new Promise((res, rej) => { diff --git a/libs/zzz/page-optimize/src/WorkerSelector.tsx b/libs/zzz/page-optimize/src/WorkerSelector.tsx index cc29b004b9..61a5be19cf 100644 --- a/libs/zzz/page-optimize/src/WorkerSelector.tsx +++ b/libs/zzz/page-optimize/src/WorkerSelector.tsx @@ -16,7 +16,9 @@ export function WorkerSelector({ {range(1, maxWorkers).map((n) => ( setNumWorkers(n)}> - {t('workers', { count: n })} + {n} Workers + {/* TODO: Translation */} + {/* {t('workers', { count: n })} */} ))} diff --git a/libs/zzz/solver/src/parentWorker.ts b/libs/zzz/solver/src/parentWorker.ts index bafdfebba7..361ee0fb17 100644 --- a/libs/zzz/solver/src/parentWorker.ts +++ b/libs/zzz/solver/src/parentWorker.ts @@ -122,9 +122,19 @@ async function start({ type: 'module', }) ) - // Wait for all workers to finish optimizing + let results: BuildResult[] = [] let numBuildsComputed = 0 + // post initial progress + postMessage({ + resultType: 'progress', + progress: { + numBuildsKept: 0, + numBuildsComputed: 0, + }, + }) + + // Wait for all workers to finish optimizing await Promise.all( workers.map((worker, index) => { return new Promise((res, rej) => {