Skip to content

Commit 30310bf

Browse files
mfdebianmarco-ippolito
authored andcommitted
doc: move numCPUs require to top of file in cluster CJS example
PR-URL: #53932 Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent bd996bf commit 30310bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/api/cluster.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ if (cluster.isPrimary) {
317317
```cjs
318318
const cluster = require('node:cluster');
319319
const http = require('node:http');
320+
const numCPUs = require('node:os').availableParallelism();
320321
const process = require('node:process');
321322

322323
if (cluster.isPrimary) {
@@ -335,7 +336,6 @@ if (cluster.isPrimary) {
335336
}
336337

337338
// Start workers and listen for messages containing notifyRequest
338-
const numCPUs = require('node:os').availableParallelism();
339339
for (let i = 0; i < numCPUs; i++) {
340340
cluster.fork();
341341
}

0 commit comments

Comments
 (0)