mirror of
https://github.com/harish2704/node-job-manager.git
synced 2026-09-10 13:11:08 +00:00
Fix: Don't call onStopped immediatly on stop(). Instead call onStopped() after finishing all running tasks
This commit is contained in:
+3
-1
@@ -90,6 +90,9 @@ JobManager.prototype.$doWork_ = function( cb ){
|
||||
}
|
||||
}
|
||||
cb();
|
||||
if( self.state == STATE.NOT_RUNNING ){
|
||||
if( ( self.runningTasks == 1 ) && self.onStopped ) { self.onStopped(); }
|
||||
}
|
||||
self.returnToPool( worker );
|
||||
});
|
||||
};
|
||||
@@ -124,7 +127,6 @@ JobManager.prototype.pause = function(){
|
||||
|
||||
JobManager.prototype.stop = function(){
|
||||
this.state = STATE.NOT_RUNNING;
|
||||
if( this.onStopped ){ this.onStopped(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user