Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct build workers perf issue #51271

Merged
merged 3 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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