repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Apply dependencies update
[poolifier.git]
/
src
/
pools
/
pool-internal.ts
diff --git
a/src/pools/pool-internal.ts
b/src/pools/pool-internal.ts
index 6e2850a892d8d63f024e09d6db40e23b43129c06..0c2454f83f9dbebbc48358ad3ab2e7c8c81fb77d 100644
(file)
--- a/
src/pools/pool-internal.ts
+++ b/
src/pools/pool-internal.ts
@@
-1,9
+1,8
@@
-import EventEmitter from 'events'
import type { IPool } from './pool'
import type { IPoolWorker } from './pool-worker'
/**
import type { IPool } from './pool'
import type { IPoolWorker } from './pool-worker'
/**
- *
P
ool types.
+ *
Internal p
ool types.
*/
export enum PoolType {
FIXED = 'fixed',
*/
export enum PoolType {
FIXED = 'fixed',
@@
-11,7
+10,7
@@
export enum PoolType {
}
/**
}
/**
- *
T
asks usage statistics.
+ *
Internal t
asks usage statistics.
*/
export interface TasksUsage {
run: number
*/
export interface TasksUsage {
run: number
@@
-20,11
+19,6
@@
export interface TasksUsage {
avgRunTime: number
}
avgRunTime: number
}
-/**
- * Internal poolifier pool emitter.
- */
-export class PoolEmitter extends EventEmitter {}
-
/**
* Internal contract definition for a poolifier pool.
*
/**
* Internal contract definition for a poolifier pool.
*
@@
-50,15
+44,6
@@
export interface IPoolInternal<
*/
readonly workersTasksUsage: Map<Worker, TasksUsage>
*/
readonly workersTasksUsage: Map<Worker, TasksUsage>
- /**
- * Emitter on which events can be listened to.
- *
- * Events that can currently be listened to:
- *
- * - `'busy'`
- */
- readonly emitter?: PoolEmitter
-
/**
* Pool type.
*
/**
* Pool type.
*
@@
-66,11
+51,6
@@
export interface IPoolInternal<
*/
readonly type: PoolType
*/
readonly type: PoolType
- /**
- * Maximum number of workers that can be created by this pool.
- */
- readonly max?: number
-
/**
* Whether the pool is busy or not.
*
/**
* Whether the pool is busy or not.
*
@@
-84,7
+64,7
@@
export interface IPoolInternal<
readonly numberOfRunningTasks: number
/**
readonly numberOfRunningTasks: number
/**
- * Find a free worker based on the number of tasks the worker has applied.
+ * Find
s
a free worker based on the number of tasks the worker has applied.
*
* If a worker is found with `0` running tasks, it is detected as free and returned.
*
*
* If a worker is found with `0` running tasks, it is detected as free and returned.
*
@@
-92,29
+72,29
@@
export interface IPoolInternal<
*
* @returns A free worker if there is one, otherwise `false`.
*/
*
* @returns A free worker if there is one, otherwise `false`.
*/
- findFreeWorker
():
Worker | false
+ findFreeWorker
: () =>
Worker | false
/**
/**
- * Get worker index.
+ * Get
s
worker index.
*
* @param worker The worker.
* @returns The worker index.
*/
*
* @param worker The worker.
* @returns The worker index.
*/
- getWorkerIndex
(worker: Worker):
number
+ getWorkerIndex
: (worker: Worker) =>
number
/**
/**
- * Get worker running tasks.
+ * Get
s
worker running tasks.
*
* @param worker The worker.
* @returns The number of tasks currently running on the worker.
*/
*
* @param worker The worker.
* @returns The number of tasks currently running on the worker.
*/
- getWorkerRunningTasks
(worker: Worker):
number | undefined
+ getWorkerRunningTasks
: (worker: Worker) =>
number | undefined
/**
/**
- * Get worker average tasks runtime.
+ * Get
s
worker average tasks runtime.
*
* @param worker The worker.
* @returns The average tasks runtime on the worker.
*/
*
* @param worker The worker.
* @returns The average tasks runtime on the worker.
*/
- getWorkerAverageTasksRunTime
(worker: Worker):
number | undefined
+ getWorkerAverageTasksRunTime
: (worker: Worker) =>
number | undefined
}
}