Skip to content
Snippets Groups Projects
Unverified Commit f58c7c75 authored by Éloïs's avatar Éloïs
Browse files

[fix] #1198

parent 4c67e0e8
Branches
Tags
2 merge requests!1220Stable/ws2p v1.1 trymerge,!1208Stable/ws2p v1.1
...@@ -42,6 +42,7 @@ export const ExecuteCommand = () => { ...@@ -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('--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('--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('--prefix <nodeId>', 'Prefix node id for the first character of nonce', parseInt)
.option('-c, --currency <name>', 'Name of the currency managed by this node.') .option('-c, --currency <name>', 'Name of the currency managed by this node.')
......
...@@ -21,6 +21,9 @@ export const ProverDependency = { ...@@ -21,6 +21,9 @@ export const ProverDependency = {
if (conf.cpu === null || conf.cpu === undefined) { if (conf.cpu === null || conf.cpu === undefined) {
conf.cpu = Constants.DEFAULT_CPU; 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) { if (conf.prefix === null || conf.prefix === undefined) {
conf.prefix = Constants.DEFAULT_PEER_ID; conf.prefix = Constants.DEFAULT_PEER_ID;
} }
......
...@@ -20,7 +20,7 @@ export class PowEngine { ...@@ -20,7 +20,7 @@ export class PowEngine {
constructor(private conf:ConfDTO, logger:any) { constructor(private conf:ConfDTO, logger:any) {
// We use as much cores as available, but not more than CORES_MAXIMUM_USE_IN_PARALLEL // 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.cluster = new PowCluster(this.nbWorkers, logger)
this.id = this.cluster.clusterId this.id = this.cluster.clusterId
} }
......
...@@ -444,6 +444,7 @@ function commandLineConf(program:any, conf:any = {}) { ...@@ -444,6 +444,7 @@ function commandLineConf(program:any, conf:any = {}) {
const cli = { const cli = {
currency: program.currency, currency: program.currency,
cpu: program.cpu, cpu: program.cpu,
nbCores: program.nbCores,
prefix: program.prefix, prefix: program.prefix,
server: { server: {
port: program.port, port: program.port,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment