Skip to content

Commit

Permalink
chore: use availableParallelism to determine thread pool size (#5691)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Jun 23, 2023
1 parent 85ac6cb commit 50daa01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/bls/multithread/poolSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ try {
if (typeof navigator !== "undefined") {
defaultPoolSize = navigator.hardwareConcurrency ?? 4;
} else {
defaultPoolSize = (await import("node:os")).cpus().length;
defaultPoolSize = (await import("node:os")).availableParallelism();
}
} catch (e) {
defaultPoolSize = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ try {
if (typeof navigator !== "undefined") {
maxPoolSize = navigator.hardwareConcurrency ?? 4;
} else {
// TODO change this line to use os.availableParallelism() once we upgrade to node v20
maxPoolSize = (await import("node:os")).cpus().length;
maxPoolSize = (await import("node:os")).availableParallelism();
}
} catch (e) {
maxPoolSize = 8;
Expand Down

0 comments on commit 50daa01

Please sign in to comment.