repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v2.4.7
[poolifier.git]
/
src
/
pools
/
cluster
/
fixed.ts
diff --git
a/src/pools/cluster/fixed.ts
b/src/pools/cluster/fixed.ts
index 33d7f1c91fa5f057bfcb1ad70e7725a6a6910102..faa68fc74ce96ece284bb953f53db02c47c154e9 100644
(file)
--- a/
src/pools/cluster/fixed.ts
+++ b/
src/pools/cluster/fixed.ts
@@
-1,9
+1,9
@@
-import type { ClusterSettings, Worker } from 'cluster'
-import cluster from 'cluster'
+import type { ClusterSettings, Worker } from '
node:
cluster'
+import cluster from '
node:
cluster'
import type { MessageValue } from '../../utility-types'
import { AbstractPool } from '../abstract-pool'
import type { PoolOptions } from '../pool'
import type { MessageValue } from '../../utility-types'
import { AbstractPool } from '../abstract-pool'
import type { PoolOptions } from '../pool'
-import { PoolType } from '../pool
-internal
'
+import { PoolType } from '../pool'
/**
* Options for a poolifier cluster pool.
/**
* Options for a poolifier cluster pool.
@@
-31,8
+31,8
@@
export interface ClusterPoolOptions extends PoolOptions<Worker> {
*
* This pool selects the workers in a round robin fashion.
*
*
* This pool selects the workers in a round robin fashion.
*
- * @t
emplate Data
Type of data sent to the worker. This can only be serializable data.
- * @t
emplate Response
Type of response of execution. This can only be serializable data.
+ * @t
ypeParam Data -
Type of data sent to the worker. This can only be serializable data.
+ * @t
ypeParam Response -
Type of response of execution. This can only be serializable data.
* @author [Christopher Quadflieg](https://github.com/Shinigami92)
* @since 2.0.0
*/
* @author [Christopher Quadflieg](https://github.com/Shinigami92)
* @since 2.0.0
*/
@@
-43,9
+43,9
@@
export class FixedClusterPool<
/**
* Constructs a new poolifier fixed cluster pool.
*
/**
* Constructs a new poolifier fixed cluster pool.
*
- * @param numberOfWorkers Number of workers for this pool.
- * @param filePath Path to an implementation of a `ClusterWorker` file, which can be relative or absolute.
- * @param opts Options for this fixed cluster pool.
+ * @param numberOfWorkers
-
Number of workers for this pool.
+ * @param filePath
-
Path to an implementation of a `ClusterWorker` file, which can be relative or absolute.
+ * @param opts
-
Options for this fixed cluster pool.
*/
public constructor (
numberOfWorkers: number,
*/
public constructor (
numberOfWorkers: number,
@@
-66,7
+66,7
@@
export class FixedClusterPool<
}
/** @inheritDoc */
}
/** @inheritDoc */
- p
ublic
destroyWorker (worker: Worker): void {
+ p
rotected
destroyWorker (worker: Worker): void {
this.sendToWorker(worker, { kill: 1 })
worker.kill()
}
this.sendToWorker(worker, { kill: 1 })
worker.kill()
}
@@
-77,7
+77,7
@@
export class FixedClusterPool<
}
/** @inheritDoc */
}
/** @inheritDoc */
- p
ublic registerWorkerMessageListener<Message extends Data | Response>
(
+ p
rotected registerWorkerMessageListener<Message extends Data | Response>
(
worker: Worker,
listener: (message: MessageValue<Message>) => void
): void {
worker: Worker,
listener: (message: MessageValue<Message>) => void
): void {
@@
-101,7
+101,12
@@
export class FixedClusterPool<
}
/** @inheritDoc */
}
/** @inheritDoc */
- public get busy (): boolean {
- return this.internalGetBusyStatus()
+ protected get full (): boolean {
+ return this.workerNodes.length === this.numberOfWorkers
+ }
+
+ /** @inheritDoc */
+ protected get busy (): boolean {
+ return this.internalBusy()
}
}
}
}