File tree 1 file changed +9
-3
lines changed
packages/docusaurus/src/ssg
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -80,11 +80,17 @@ function getNumberOfThreads(pathnames: string[]) {
80
80
if ( typeof SSGWorkerThreadCount !== 'undefined' ) {
81
81
return SSGWorkerThreadCount ;
82
82
}
83
+
84
+ // See also https://github.com/tinylibs/tinypool/pull/108
85
+ const cpuCount =
86
+ // TODO Docusaurus v4: bump node, availableParallelism() now always exists
87
+ typeof os . availableParallelism === 'function'
88
+ ? os . availableParallelism ( )
89
+ : os . cpus ( ) . length ;
90
+
83
91
return inferNumberOfThreads ( {
84
92
pageCount : pathnames . length ,
85
- // TODO use "physical CPUs" instead of "logical CPUs" (like Tinypool does)
86
- // See also https://github.com/tinylibs/tinypool/pull/108
87
- cpuCount : os . cpus ( ) . length ,
93
+ cpuCount,
88
94
// These are "magic value" that we should refine based on user feedback
89
95
// Local tests show that it's not worth spawning new workers for few pages
90
96
minPagesPerCpu : 100 ,
You can’t perform that action at this time.
0 commit comments