thread-loader
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.1.2"></a> | ||
## [2.1.2](https://github.com/webpack-contrib/thread-loader/compare/v2.1.1...v2.1.2) (2019-01-25) | ||
### Bug Fixes | ||
* lifecycle handling for signals | ||
<a name="2.1.1"></a> | ||
@@ -7,0 +17,0 @@ ## [2.1.1](https://github.com/webpack-contrib/thread-loader/compare/v2.1.0...v2.1.1) (2018-12-21) |
@@ -294,22 +294,15 @@ 'use strict'; | ||
terminate(force) { | ||
if (!this.terminated) { | ||
this.terminated = true; | ||
terminate() { | ||
if (this.terminated) { | ||
return; | ||
} | ||
this.poolQueue.kill(); | ||
this.disposeWorkers(force); | ||
} | ||
this.terminated = true; | ||
this.poolQueue.kill(); | ||
this.disposeWorkers(true); | ||
} | ||
setupLifeCycle() { | ||
process.on('SIGTERM', () => { | ||
this.terminate(true); | ||
}); | ||
process.on('SIGINT', () => { | ||
this.terminate(true); | ||
}); | ||
process.on('exit', () => { | ||
this.terminate(true); | ||
this.terminate(); | ||
}); | ||
@@ -366,4 +359,9 @@ } | ||
disposeWorkers(force) { | ||
if (this.activeJobs === 0 || force) { | ||
disposeWorkers(fromTerminate) { | ||
if (!this.options.poolRespawn && !fromTerminate) { | ||
this.terminate(); | ||
return; | ||
} | ||
if (this.activeJobs === 0 || fromTerminate) { | ||
for (const worker of this.workers) { | ||
@@ -374,7 +372,4 @@ worker.dispose(); | ||
} | ||
if (!this.options.poolRespawn) { | ||
this.terminate(); | ||
} | ||
} | ||
} | ||
exports.default = WorkerPool; |
{ | ||
"name": "thread-loader", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Runs the following loaders in a worker pool", | ||
@@ -5,0 +5,0 @@ "author": "Tobias Koppers @sokra", |
35605
730