mirror of
https://github.com/harish2704/node-job-manager.git
synced 2026-09-10 13:11:08 +00:00
Add support for minimum concurrency . SetConcurrency method can not assign value below this value.
It need to be replaced with nonlinear function
This commit is contained in:
+2
-1
@@ -9,6 +9,7 @@ function JobManager(opts){
|
||||
//opts
|
||||
this.notifyAt = opts.notifyAt|| 3;
|
||||
this.concurrency = opts.concurrency || 20;
|
||||
this.minConcurrency = opts.minConcurrency != null ? opts.minConcurrency : 2;
|
||||
|
||||
// state
|
||||
this.state = STATE.NOT_RUNNING;
|
||||
@@ -40,7 +41,7 @@ JobManager.prototype.updateState = function(){
|
||||
};
|
||||
|
||||
JobManager.prototype.setConcurrency = function( newVal ){
|
||||
if( newVal > 1){
|
||||
if( newVal > this.minConcurrency ){
|
||||
if( newVal > this.tmpPoolLen ){
|
||||
var tmpPool = this.tmpPool;
|
||||
var additionalPoolBlocks = Math.ceil( ( newVal - this.tmpPoolLen )/this.workers.length ), i;
|
||||
|
||||
Reference in New Issue
Block a user