repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Sync version in package.json with the one in lock file.
[poolifier.git]
/
src
/
dynamic.ts
diff --git
a/src/dynamic.ts
b/src/dynamic.ts
index 667fa07a29780a4837c8f5a7f3af7643c8bb61e4..211141ca5535e0a864d22d38c8ee167e0930dc8f 100644
(file)
--- a/
src/dynamic.ts
+++ b/
src/dynamic.ts
@@
-1,3
+1,5
@@
+/* eslint-disable @typescript-eslint/strict-boolean-expressions */
+
import FixedThreadPool, {
FixedThreadPoolOptions,
WorkerWithMessageChannel
import FixedThreadPool, {
FixedThreadPoolOptions,
WorkerWithMessageChannel
@@
-42,7
+44,7
@@
export default class DynamicThreadPool<
}
protected _chooseWorker (): WorkerWithMessageChannel {
}
protected _chooseWorker (): WorkerWithMessageChannel {
- let worker: WorkerWithMessageChannel
+ let worker: WorkerWithMessageChannel
| undefined
for (const entry of this.tasks) {
if (entry[1] === 0) {
worker = entry[0]
for (const entry of this.tasks) {
if (entry[1] === 0) {
worker = entry[0]
@@
-60,10
+62,11
@@
export default class DynamicThreadPool<
}
// all workers are busy create a new worker
const worker = this._newWorker()
}
// all workers are busy create a new worker
const worker = this._newWorker()
- worker.port2
.on('message', (message
) => {
+ worker.port2
?.on('message', (message: { kill?: number }
) => {
if (message.kill) {
worker.postMessage({ kill: 1 })
if (message.kill) {
worker.postMessage({ kill: 1 })
- worker.terminate()
+ // eslint-disable-next-line no-void
+ void worker.terminate()
// clean workers from data structures
const workerIndex = this.workers.indexOf(worker)
this.workers.splice(workerIndex, 1)
// clean workers from data structures
const workerIndex = this.workers.indexOf(worker)
this.workers.splice(workerIndex, 1)