repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into feature/task-functions
[poolifier.git]
/
src
/
pools
/
cluster
/
fixed.ts
diff --git
a/src/pools/cluster/fixed.ts
b/src/pools/cluster/fixed.ts
index b5b32527cf595b8b4ec8f52f3290a10e4647cbd4..9470cccd857321388d70e0bf7f09de1a20505cfe 100644
(file)
--- a/
src/pools/cluster/fixed.ts
+++ b/
src/pools/cluster/fixed.ts
@@
-63,8
+63,9
@@
export class FixedClusterPool<
protected async destroyWorkerNode (workerNodeKey: number): Promise<void> {
this.flushTasksQueue(workerNodeKey)
// FIXME: wait for tasks to be finished
protected async destroyWorkerNode (workerNodeKey: number): Promise<void> {
this.flushTasksQueue(workerNodeKey)
// FIXME: wait for tasks to be finished
- const worker = this.workerNodes[workerNodeKey].worker
- const waitWorkerExit = new Promise<void>((resolve) => {
+ const workerNode = this.workerNodes[workerNodeKey]
+ const worker = workerNode.worker
+ const waitWorkerExit = new Promise<void>(resolve => {
worker.on('exit', () => {
resolve()
})
worker.on('exit', () => {
resolve()
})
@@
-72,7
+73,7
@@
export class FixedClusterPool<
worker.on('disconnect', () => {
worker.kill()
})
worker.on('disconnect', () => {
worker.kill()
})
-
this.sendToWorker(workerNodeKey, { kill: true, workerId: worker.id }
)
+
await this.sendKillMessageToWorker(workerNodeKey
)
worker.disconnect()
await waitWorkerExit
}
worker.disconnect()
await waitWorkerExit
}
@@
-82,14
+83,16
@@
export class FixedClusterPool<
workerNodeKey: number,
message: MessageValue<Data>
): void {
workerNodeKey: number,
message: MessageValue<Data>
): void {
- this.workerNodes[workerNodeKey].worker.send(message)
+ this.workerNodes[workerNodeKey].worker.send({
+ ...message,
+ workerId: this.workerNodes[workerNodeKey].info.id as number
+ })
}
/** @inheritDoc */
protected sendStartupMessageToWorker (workerNodeKey: number): void {
this.sendToWorker(workerNodeKey, {
}
/** @inheritDoc */
protected sendStartupMessageToWorker (workerNodeKey: number): void {
this.sendToWorker(workerNodeKey, {
- ready: false,
- workerId: this.workerNodes[workerNodeKey].worker.id
+ ready: false
})
}
})
}
@@
-116,16
+119,6
@@
export class FixedClusterPool<
return WorkerTypes.cluster
}
return WorkerTypes.cluster
}
- /** @inheritDoc */
- protected get minSize (): number {
- return this.numberOfWorkers
- }
-
- /** @inheritDoc */
- protected get maxSize (): number {
- return this.numberOfWorkers
- }
-
/** @inheritDoc */
protected get busy (): boolean {
return this.internalBusy()
/** @inheritDoc */
protected get busy (): boolean {
return this.internalBusy()