Skip to content

Commit

Permalink
fix: stop chrome cluster when scan is finished
Browse files Browse the repository at this point in the history
Fixes #246
  • Loading branch information
harlan-zw committed Jan 1, 2025
1 parent c28fcc7 commit a3ee8f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a3ee8f0

Please sign in to comment.