cap number of threads for --num-threads=0 (#3547)

* cap number of threads for --num-threads=0

* cap at 16 threads instead
This commit is contained in:
tersec 2022-03-28 16:33:25 +00:00 committed by GitHub
parent 57fc9d5433
commit d63b836f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -352,7 +352,7 @@ proc init*(T: type BeaconNode,
fatal "The number of threads --numThreads cannot be negative." fatal "The number of threads --numThreads cannot be negative."
quit 1 quit 1
elif config.numThreads == 0: elif config.numThreads == 0:
taskpool = TaskpoolPtr.new() taskpool = TaskpoolPtr.new(numThreads = min(countProcessors(), 16))
else: else:
taskpool = TaskpoolPtr.new(numThreads = config.numThreads) taskpool = TaskpoolPtr.new(numThreads = config.numThreads)