repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v3.1.29
[poolifier.git]
/
src
/
pools
/
pool.ts
diff --git
a/src/pools/pool.ts
b/src/pools/pool.ts
index cda63d881f0bab742cf0412cfa266714fdefeb27..d7b6eeabeb074c31103854ec2f9789d137ff8409 100644
(file)
--- a/
src/pools/pool.ts
+++ b/
src/pools/pool.ts
@@
-1,7
+1,12
@@
-import type { TransferListItem, WorkerOptions } from 'node:worker_threads'
-import type { EventEmitterAsyncResource } from 'node:events'
import type { ClusterSettings } from 'node:cluster'
import type { ClusterSettings } from 'node:cluster'
+import type { EventEmitterAsyncResource } from 'node:events'
+import type { TransferListItem, WorkerOptions } from 'node:worker_threads'
+
import type { TaskFunction } from '../worker/task-functions.js'
import type { TaskFunction } from '../worker/task-functions.js'
+import type {
+ WorkerChoiceStrategy,
+ WorkerChoiceStrategyOptions
+} from './selection-strategies/selection-strategies-types.js'
import type {
ErrorHandler,
ExitHandler,
import type {
ErrorHandler,
ExitHandler,
@@
-11,15
+16,14
@@
import type {
OnlineHandler,
WorkerType
} from './worker.js'
OnlineHandler,
WorkerType
} from './worker.js'
-import type {
- WorkerChoiceStrategy,
- WorkerChoiceStrategyOptions
-} from './selection-strategies/selection-strategies-types.js'
/**
* Enumeration of pool types.
*/
/**
* Enumeration of pool types.
*/
-export const PoolTypes = Object.freeze({
+export const PoolTypes: Readonly<{
+ fixed: 'fixed'
+ dynamic: 'dynamic'
+}> = Object.freeze({
/**
* Fixed pool type.
*/
/**
* Fixed pool type.
*/
@@
-38,7
+42,16
@@
export type PoolType = keyof typeof PoolTypes
/**
* Enumeration of pool events.
*/
/**
* Enumeration of pool events.
*/
-export const PoolEvents = Object.freeze({
+export const PoolEvents: Readonly<{
+ ready: 'ready'
+ busy: 'busy'
+ full: 'full'
+ empty: 'empty'
+ destroy: 'destroy'
+ error: 'error'
+ taskError: 'taskError'
+ backPressure: 'backPressure'
+}> = Object.freeze({
ready: 'ready',
busy: 'busy',
full: 'full',
ready: 'ready',
busy: 'busy',
full: 'full',
@@
-64,6
+77,7
@@
export interface PoolInfo {
readonly started: boolean
readonly ready: boolean
readonly strategy: WorkerChoiceStrategy
readonly started: boolean
readonly ready: boolean
readonly strategy: WorkerChoiceStrategy
+ readonly strategyRetries: number
readonly minSize: number
readonly maxSize: number
/** Pool utilization. */
readonly minSize: number
readonly maxSize: number
/** Pool utilization. */
@@
-242,7
+256,7
@@
export interface IPool<
*/
readonly workerNodes: Array<IWorkerNode<Worker, Data>>
/**
*/
readonly workerNodes: Array<IWorkerNode<Worker, Data>>
/**
- *
Event emitter integrated with async resource on which events can be listened to
.
+ *
Pool event emitter integrated with async resource
.
* The async tracking tooling identifier is `poolifier:<PoolType>-<WorkerType>-pool`.
*
* Events that can currently be listened to:
* The async tracking tooling identifier is `poolifier:<PoolType>-<WorkerType>-pool`.
*
* Events that can currently be listened to: