Skip to content

Commit

Permalink
Correct build workers perf issue (#51271)
Browse files Browse the repository at this point in the history
This continues off of #49937 and
#50194 ensuring we don't regress
on build perf due to reducing the amount of workers being used in
parallel.

Fixes: #51201
Fixes: #50555
  • Loading branch information
ijjk committed Jun 14, 2023
1 parent 862f556 commit f676d00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
6 changes: 1 addition & 5 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1141,10 +1141,6 @@ export default async function build(
: config.experimental.cpus || 4

function createStaticWorker(type: 'app' | 'pages') {
const numWorkersPerType = isAppDirEnabled
? Math.max(1, ~~(numWorkers / 2))
: numWorkers

let infoPrinted = false

return new Worker(staticWorkerPath, {
Expand Down Expand Up @@ -1178,7 +1174,7 @@ export default async function build(
infoPrinted = true
}
},
numWorkers: numWorkersPerType,
numWorkers,
forkOptions: {
env: {
...process.env,
Expand Down
17 changes: 4 additions & 13 deletions test/integration/with-router/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,23 @@ import {
killApp,
launchApp,
nextBuild,
nextServer,
startApp,
stopApp,
nextStart,
} from 'next-test-utils'
import webdriver from 'next-webdriver'
import { join } from 'path'

describe('withRouter', () => {
const appDir = join(__dirname, '../')
let appPort
let server
let app

beforeAll(async () => {
await nextBuild(appDir)
app = nextServer({
dir: join(__dirname, '../'),
dev: false,
quiet: true,
})

server = await startApp(app)
appPort = server.address().port
appPort = await findPort()
app = await nextStart(appDir, appPort)
})

afterAll(() => stopApp(server))
afterAll(() => killApp(app))

it('allows observation of navigation events using withRouter', async () => {
const browser = await webdriver(appPort, '/a')
Expand Down

0 comments on commit f676d00

Please sign in to comment.