Unverified Commit f58c7c75 authored by Éloïs's avatar Éloïs
Browse files

[fix] #1198

parent 4c67e0e8
......@@ -42,6 +42,7 @@ export const ExecuteCommand = () => {
.option('--remep <endpoint>', 'With `config` command, remove given endpoint to the list of endpoints of this node')
.option('--cpu <percent>', 'Percent of CPU usage for proof-of-work computation', parsePercent)
.option('--nb-cores <number>', 'Number of cores uses for proof-of-work computation', parseInt)
.option('--prefix <nodeId>', 'Prefix node id for the first character of nonce', parseInt)
.option('-c, --currency <name>', 'Name of the currency managed by this node.')
......
......@@ -21,6 +21,9 @@ export const ProverDependency = {
if (conf.cpu === null || conf.cpu === undefined) {
conf.cpu = Constants.DEFAULT_CPU;
}
if (conf.nbCores === null || conf.nbCores === undefined) {
conf.nbCores = Math.min(Constants.CORES_MAXIMUM_USE_IN_PARALLEL, require('os').cpus().length)
}
if (conf.prefix === null || conf.prefix === undefined) {
conf.prefix = Constants.DEFAULT_PEER_ID;
}
......
......@@ -20,7 +20,7 @@ export class PowEngine {
constructor(private conf:ConfDTO, logger:any) {
// We use as much cores as available, but not more than CORES_MAXIMUM_USE_IN_PARALLEL
this.nbWorkers = (conf && conf.nbCores) || Math.min(Constants.CORES_MAXIMUM_USE_IN_PARALLEL, require('os').cpus().length)
this.nbWorkers = conf.nbCores
this.cluster = new PowCluster(this.nbWorkers, logger)
this.id = this.cluster.clusterId
}
......
......@@ -444,6 +444,7 @@ function commandLineConf(program:any, conf:any = {}) {
const cli = {
currency: program.currency,
cpu: program.cpu,
nbCores: program.nbCores,
prefix: program.prefix,
server: {
port: program.port,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment