From a3ee8f0c4c6cb2eafe63080bb493504ec79c4b99 Mon Sep 17 00:00:00 2001 From: harlan Date: Wed, 1 Jan 2025 22:09:26 +1100 Subject: [PATCH] fix: stop chrome cluster when scan is finished Fixes #246 --- packages/cli/src/cli.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 1de95f31..88b42fe5 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -40,11 +40,12 @@ async function run() { process.exit(1) } - unlighthouse.hooks.hook('worker-finished', () => { + unlighthouse.hooks.hook('worker-finished', async () => { const end = new Date() const seconds = Math.round((end.getTime() - start.getTime()) / 1000) logger.success(`Unlighthouse has finished scanning \`${unlighthouse.resolvedConfig.site}\`: ${unlighthouse.worker.reports().length} routes in \`${seconds}s\`.`) + await unlighthouse.worker.cluster.close().catch(() => {}) }) if (unlighthouse.resolvedConfig.server.open)