Browse Source

Add support for minimum concurrency . SetConcurrency method can not assign value below this value.

It need to be replaced with nonlinear function
master
Harish.K 11 years ago
parent
commit
bc8c4792e0
  1. 3
      src/JobManager.js

3
src/JobManager.js

@ -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;

Loading…
Cancel
Save