fix(pool): added optional setting for killing processes and not retaining them#1173
fix(pool): added optional setting for killing processes and not retaining them#1173dawiss1337 wants to merge 5 commits into
Conversation
|
@manast would appreciate if you could take a look at this PR |
1 similar comment
|
@DavisJaunzems sorry for the late response. It has been a hectic week so far. |
|
|
||
| _opts.attempts = typeof _opts.attempts == 'undefined' ? 1 : _opts.attempts; | ||
| _opts.delay = typeof _opts.delay == 'undefined' ? 0 : _opts.delay; | ||
| _opts.delay = typeof _opts.delay == 'undefined' ? 0 : Number(_opts.delay); |
There was a problem hiding this comment.
this fix seems to have been slipped in from an unrelated issue.
|
|
||
| return pool.retain(processor).then(function(_child) { | ||
| expect(_child).to.be.ok; | ||
| child = _child; |
There was a problem hiding this comment.
Must have been from copy-paste, you are right no need for re-assigned the variable, could pool.release(_child); directly
There was a problem hiding this comment.
Updated PR, removed the unnecessary reassignment
| this.free = {}; | ||
| }; | ||
|
|
||
| ChildPool.prototype.setKeepProcesses = function(keepProcesses) { |
There was a problem hiding this comment.
I am thinking that it would be better to change the name to a more explanatory: setReuseProcesses or similar.
There was a problem hiding this comment.
renamed the methods and variables in the latest PR
| this.getJobFromId = Job.fromId.bind(null, this); | ||
|
|
||
| // Check settings to see if processes will be kept after finishing processing, default set to true | ||
| this.keepProcesses = |
There was a problem hiding this comment.
Since we are setting a default value true a few lines above, this is not necessary.
| }); | ||
| }; | ||
|
|
||
| Queue.prototype.setKeepProcesses = function(keepProcesses) { |
There was a problem hiding this comment.
I do not think we need a setter for this setting, as with the other settings.
|
The latest commit has changed method and variable names, and removed redundant code @manast |
|
There are 3 format issues preventing the tests from running: |
|
@manast what command did you run to get these errors, because I can run all of the tests locally? |
|
@DavisJaunzems The command that you can run locally: |
|
@manast updated the code, anything else before this can be merged? |
|
The PR was spoiled, but the feature is good. @manast may it be merged for the next release? |
|
In order to merge this we need to rework it according to the comments and make it pass the tests. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Created optional setting for child pool, default is set to
true- always retains child processes, but when set tofalsethe child process is killed and not retained after finishing processing.