mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
Disallow excessive GOMAXPROCS (#368)
This commit is contained in:
parent
b94e123262
commit
8ce9aeee4e
@ -34,4 +34,6 @@ type EngineConfig struct {
|
||||
// Values used only for testing – do not override these in production, your
|
||||
// node will get kicked out
|
||||
Difficulty uint32 `yaml:"difficulty"`
|
||||
// Whether to allow GOMAXPROCS values above the number of physical cores.
|
||||
AllowExcessiveGOMAXPROCS bool `yaml:"allowExcessiveGOMAXPROCS"`
|
||||
}
|
||||
|
||||
@ -394,6 +394,12 @@ func main() {
|
||||
nodeConfig.Engine.DataWorkerMemoryLimit = 1792 * 1024 * 1024 // 1.75GiB
|
||||
}
|
||||
if len(nodeConfig.Engine.DataWorkerMultiaddrs) == 0 {
|
||||
maxProcs, numCPU := runtime.GOMAXPROCS(0), runtime.NumCPU()
|
||||
if maxProcs > numCPU && !nodeConfig.Engine.AllowExcessiveGOMAXPROCS {
|
||||
fmt.Println("GOMAXPROCS is set higher than the number of available CPUs.")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
nodeConfig.Engine.DataWorkerCount = qruntime.WorkerCount(
|
||||
nodeConfig.Engine.DataWorkerCount, true,
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user