poolifier 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/index.d.ts +773 -15
- package/lib/index.js +1 -1
- package/package.json +22 -22
- package/CHANGELOG.md +0 -107
- package/lib/pools/abstract-pool.d.ts +0 -245
- package/lib/pools/cluster/dynamic.d.ts +0 -30
- package/lib/pools/cluster/fixed.d.ts +0 -58
- package/lib/pools/pool-internal.d.ts +0 -74
- package/lib/pools/pool.d.ts +0 -26
- package/lib/pools/selection-strategies.d.ts +0 -58
- package/lib/pools/thread/dynamic.d.ts +0 -31
- package/lib/pools/thread/fixed.d.ts +0 -48
- package/lib/utility-types.d.ts +0 -58
- package/lib/utils.d.ts +0 -4
- package/lib/worker/abstract-worker.d.ts +0 -79
- package/lib/worker/cluster-worker.d.ts +0 -32
- package/lib/worker/thread-worker.d.ts +0 -30
- package/lib/worker/worker-options.d.ts +0 -61
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { IWorker } from './abstract-pool';
|
|
2
|
-
import type { IPoolInternal } from './pool-internal';
|
|
3
|
-
/**
|
|
4
|
-
* Enumeration of worker choice strategies.
|
|
5
|
-
*/
|
|
6
|
-
export declare const WorkerChoiceStrategies: Readonly<{
|
|
7
|
-
/**
|
|
8
|
-
* Round robin worker selection strategy.
|
|
9
|
-
*/
|
|
10
|
-
readonly ROUND_ROBIN: "ROUND_ROBIN";
|
|
11
|
-
/**
|
|
12
|
-
* Less recently used worker selection strategy.
|
|
13
|
-
*/
|
|
14
|
-
readonly LESS_RECENTLY_USED: "LESS_RECENTLY_USED";
|
|
15
|
-
}>;
|
|
16
|
-
/**
|
|
17
|
-
* Worker choice strategy.
|
|
18
|
-
*/
|
|
19
|
-
export declare type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies;
|
|
20
|
-
/**
|
|
21
|
-
* The worker choice strategy context.
|
|
22
|
-
*
|
|
23
|
-
* @template Worker Type of worker.
|
|
24
|
-
* @template Data Type of data sent to the worker. This can only be serializable data.
|
|
25
|
-
* @template Response Type of response of execution. This can only be serializable data.
|
|
26
|
-
*/
|
|
27
|
-
export declare class WorkerChoiceStrategyContext<Worker extends IWorker, Data, Response> {
|
|
28
|
-
private readonly pool;
|
|
29
|
-
private createDynamicallyWorkerCallback;
|
|
30
|
-
private workerChoiceStrategy;
|
|
31
|
-
/**
|
|
32
|
-
* Worker choice strategy context constructor.
|
|
33
|
-
*
|
|
34
|
-
* @param pool The pool instance.
|
|
35
|
-
* @param createDynamicallyWorkerCallback The worker creation callback for dynamic pool.
|
|
36
|
-
* @param workerChoiceStrategy The worker choice strategy.
|
|
37
|
-
*/
|
|
38
|
-
constructor(pool: IPoolInternal<Worker, Data, Response>, createDynamicallyWorkerCallback: () => Worker, workerChoiceStrategy?: WorkerChoiceStrategy);
|
|
39
|
-
/**
|
|
40
|
-
* Get the worker choice strategy instance specific to the pool type.
|
|
41
|
-
*
|
|
42
|
-
* @param workerChoiceStrategy The worker choice strategy.
|
|
43
|
-
* @returns The worker choice strategy instance for the pool type.
|
|
44
|
-
*/
|
|
45
|
-
private getPoolWorkerChoiceStrategy;
|
|
46
|
-
/**
|
|
47
|
-
* Set the worker choice strategy to use in the context.
|
|
48
|
-
*
|
|
49
|
-
* @param workerChoiceStrategy The worker choice strategy to set.
|
|
50
|
-
*/
|
|
51
|
-
setWorkerChoiceStrategy(workerChoiceStrategy: WorkerChoiceStrategy): void;
|
|
52
|
-
/**
|
|
53
|
-
* Choose a worker with the underlying selection strategy.
|
|
54
|
-
*
|
|
55
|
-
* @returns The chosen one.
|
|
56
|
-
*/
|
|
57
|
-
execute(): Worker;
|
|
58
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { PoolOptions } from '../abstract-pool';
|
|
2
|
-
import { PoolType } from '../pool-internal';
|
|
3
|
-
import type { ThreadWorkerWithMessageChannel } from './fixed';
|
|
4
|
-
import { FixedThreadPool } from './fixed';
|
|
5
|
-
/**
|
|
6
|
-
* A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.
|
|
7
|
-
*
|
|
8
|
-
* This thread pool creates new threads when the others are busy, up to the maximum number of threads.
|
|
9
|
-
* When the maximum number of threads is reached, an event is emitted. If you want to listen to this event, use the pool's `emitter`.
|
|
10
|
-
*
|
|
11
|
-
* @template DataType of data sent to the worker. This can only be serializable data.
|
|
12
|
-
* @template ResponseType of response of execution. This can only be serializable data.
|
|
13
|
-
* @author [Alessandro Pio Ardizio](https://github.com/pioardi)
|
|
14
|
-
* @since 0.0.1
|
|
15
|
-
*/
|
|
16
|
-
export declare class DynamicThreadPool<Data = unknown, Response = unknown> extends FixedThreadPool<Data, Response> {
|
|
17
|
-
readonly max: number;
|
|
18
|
-
/**
|
|
19
|
-
* Constructs a new poolifier dynamic thread pool.
|
|
20
|
-
*
|
|
21
|
-
* @param min Minimum number of threads which are always active.
|
|
22
|
-
* @param max Maximum number of threads that can be created by this pool.
|
|
23
|
-
* @param filePath Path to an implementation of a `ThreadWorker` file, which can be relative or absolute.
|
|
24
|
-
* @param [opts={}] Options for this dynamic thread pool.
|
|
25
|
-
*/
|
|
26
|
-
constructor(min: number, max: number, filePath: string, opts?: PoolOptions<ThreadWorkerWithMessageChannel>);
|
|
27
|
-
/** @inheritdoc */
|
|
28
|
-
get type(): PoolType;
|
|
29
|
-
/** @inheritdoc */
|
|
30
|
-
get busy(): boolean;
|
|
31
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { MessageChannel, Worker } from 'worker_threads';
|
|
3
|
-
import type { Draft, MessageValue } from '../../utility-types';
|
|
4
|
-
import type { PoolOptions } from '../abstract-pool';
|
|
5
|
-
import { AbstractPool } from '../abstract-pool';
|
|
6
|
-
import { PoolType } from '../pool-internal';
|
|
7
|
-
/**
|
|
8
|
-
* A thread worker with message channels for communication between main thread and thread worker.
|
|
9
|
-
*/
|
|
10
|
-
export declare type ThreadWorkerWithMessageChannel = Worker & Draft<MessageChannel>;
|
|
11
|
-
/**
|
|
12
|
-
* A thread pool with a fixed number of threads.
|
|
13
|
-
*
|
|
14
|
-
* It is possible to perform tasks in sync or asynchronous mode as you prefer.
|
|
15
|
-
*
|
|
16
|
-
* This pool selects the threads in a round robin fashion.
|
|
17
|
-
*
|
|
18
|
-
* @template DataType of data sent to the worker. This can only be serializable data.
|
|
19
|
-
* @template ResponseType of response of execution. This can only be serializable data.
|
|
20
|
-
* @author [Alessandro Pio Ardizio](https://github.com/pioardi)
|
|
21
|
-
* @since 0.0.1
|
|
22
|
-
*/
|
|
23
|
-
export declare class FixedThreadPool<Data = unknown, Response = unknown> extends AbstractPool<ThreadWorkerWithMessageChannel, Data, Response> {
|
|
24
|
-
/**
|
|
25
|
-
* Constructs a new poolifier fixed thread pool.
|
|
26
|
-
*
|
|
27
|
-
* @param numberOfThreads Number of threads for this pool.
|
|
28
|
-
* @param filePath Path to an implementation of a `ThreadWorker` file, which can be relative or absolute.
|
|
29
|
-
* @param [opts={}] Options for this fixed thread pool.
|
|
30
|
-
*/
|
|
31
|
-
constructor(numberOfThreads: number, filePath: string, opts?: PoolOptions<ThreadWorkerWithMessageChannel>);
|
|
32
|
-
/** @inheritdoc */
|
|
33
|
-
protected isMain(): boolean;
|
|
34
|
-
/** @inheritdoc */
|
|
35
|
-
destroyWorker(worker: ThreadWorkerWithMessageChannel): Promise<void>;
|
|
36
|
-
/** @inheritdoc */
|
|
37
|
-
protected sendToWorker(worker: ThreadWorkerWithMessageChannel, message: MessageValue<Data>): void;
|
|
38
|
-
/** @inheritdoc */
|
|
39
|
-
registerWorkerMessageListener<Message extends Data | Response>(messageChannel: ThreadWorkerWithMessageChannel, listener: (message: MessageValue<Message>) => void): void;
|
|
40
|
-
/** @inheritdoc */
|
|
41
|
-
protected createWorker(): ThreadWorkerWithMessageChannel;
|
|
42
|
-
/** @inheritdoc */
|
|
43
|
-
protected afterWorkerSetup(worker: ThreadWorkerWithMessageChannel): void;
|
|
44
|
-
/** @inheritdoc */
|
|
45
|
-
get type(): PoolType;
|
|
46
|
-
/** @inheritdoc */
|
|
47
|
-
get busy(): boolean;
|
|
48
|
-
}
|
package/lib/utility-types.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Worker } from 'cluster';
|
|
3
|
-
import type { MessagePort } from 'worker_threads';
|
|
4
|
-
import type { IWorker } from './pools/abstract-pool';
|
|
5
|
-
import type { KillBehavior } from './worker/worker-options';
|
|
6
|
-
/**
|
|
7
|
-
* Make all properties in T non-readonly.
|
|
8
|
-
*/
|
|
9
|
-
export declare type Draft<T> = {
|
|
10
|
-
-readonly [P in keyof T]?: T[P];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Message object that is passed between worker and main worker.
|
|
14
|
-
*/
|
|
15
|
-
export interface MessageValue<Data = unknown, MainWorker extends Worker | MessagePort | unknown = unknown> {
|
|
16
|
-
/**
|
|
17
|
-
* Input data that will be passed to the worker.
|
|
18
|
-
*/
|
|
19
|
-
readonly data?: Data;
|
|
20
|
-
/**
|
|
21
|
-
* Id of the message.
|
|
22
|
-
*/
|
|
23
|
-
readonly id?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Kill code.
|
|
26
|
-
*/
|
|
27
|
-
readonly kill?: KillBehavior | 1;
|
|
28
|
-
/**
|
|
29
|
-
* Error.
|
|
30
|
-
*/
|
|
31
|
-
readonly error?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Reference to main worker.
|
|
34
|
-
*
|
|
35
|
-
* _Only for internal use_
|
|
36
|
-
*/
|
|
37
|
-
readonly parent?: MainWorker;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* An object holding the worker that will be used to resolve/rejects the promise later on.
|
|
41
|
-
*
|
|
42
|
-
* @template Worker Type of worker.
|
|
43
|
-
* @template Response Type of response of execution. This can only be serializable data.
|
|
44
|
-
*/
|
|
45
|
-
export interface PromiseWorkerResponseWrapper<Worker extends IWorker, Response = unknown> {
|
|
46
|
-
/**
|
|
47
|
-
* Resolve callback to fulfill the promise.
|
|
48
|
-
*/
|
|
49
|
-
readonly resolve: (value: Response) => void;
|
|
50
|
-
/**
|
|
51
|
-
* Reject callback to reject the promise.
|
|
52
|
-
*/
|
|
53
|
-
readonly reject: (reason?: string) => void;
|
|
54
|
-
/**
|
|
55
|
-
* The worker that has the assigned task.
|
|
56
|
-
*/
|
|
57
|
-
readonly worker: Worker;
|
|
58
|
-
}
|
package/lib/utils.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { AsyncResource } from 'async_hooks';
|
|
3
|
-
import type { Worker } from 'cluster';
|
|
4
|
-
import type { MessagePort } from 'worker_threads';
|
|
5
|
-
import type { MessageValue } from '../utility-types';
|
|
6
|
-
import type { WorkerOptions } from './worker-options';
|
|
7
|
-
/**
|
|
8
|
-
* Base class containing some shared logic for all poolifier workers.
|
|
9
|
-
*
|
|
10
|
-
* @template MainWorker Type of main worker.
|
|
11
|
-
* @template Data Type of data this worker receives from pool's execution. This can only be serializable data.
|
|
12
|
-
* @template Response Type of response the worker sends back to the main worker. This can only be serializable data.
|
|
13
|
-
*/
|
|
14
|
-
export declare abstract class AbstractWorker<MainWorker extends Worker | MessagePort, Data = unknown, Response = unknown> extends AsyncResource {
|
|
15
|
-
protected mainWorker: MainWorker | null;
|
|
16
|
-
readonly opts: WorkerOptions;
|
|
17
|
-
/**
|
|
18
|
-
* Timestamp of the last task processed by this worker.
|
|
19
|
-
*/
|
|
20
|
-
protected lastTaskTimestamp: number;
|
|
21
|
-
/**
|
|
22
|
-
* Handler Id of the `aliveInterval` worker alive check.
|
|
23
|
-
*/
|
|
24
|
-
protected readonly aliveInterval?: NodeJS.Timeout;
|
|
25
|
-
/**
|
|
26
|
-
* Constructs a new poolifier worker.
|
|
27
|
-
*
|
|
28
|
-
* @param type The type of async event.
|
|
29
|
-
* @param isMain Whether this is the main worker or not.
|
|
30
|
-
* @param fn Function processed by the worker when the pool's `execution` function is invoked.
|
|
31
|
-
* @param mainWorker Reference to main worker.
|
|
32
|
-
* @param opts Options for the worker.
|
|
33
|
-
*/
|
|
34
|
-
constructor(type: string, isMain: boolean, fn: (data: Data) => Response, mainWorker: MainWorker | null, opts?: WorkerOptions);
|
|
35
|
-
private checkWorkerOptions;
|
|
36
|
-
/**
|
|
37
|
-
* Check if the `fn` parameter is passed to the constructor.
|
|
38
|
-
*
|
|
39
|
-
* @param fn The function that should be defined.
|
|
40
|
-
*/
|
|
41
|
-
private checkFunctionInput;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the main worker.
|
|
44
|
-
*
|
|
45
|
-
* @returns Reference to the main worker.
|
|
46
|
-
*/
|
|
47
|
-
protected getMainWorker(): MainWorker;
|
|
48
|
-
/**
|
|
49
|
-
* Send a message to the main worker.
|
|
50
|
-
*
|
|
51
|
-
* @param message The response message.
|
|
52
|
-
*/
|
|
53
|
-
protected abstract sendToMainWorker(message: MessageValue<Response>): void;
|
|
54
|
-
/**
|
|
55
|
-
* Check to see if the worker should be terminated, because its living too long.
|
|
56
|
-
*/
|
|
57
|
-
protected checkAlive(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Handle an error and convert it to a string so it can be sent back to the main worker.
|
|
60
|
-
*
|
|
61
|
-
* @param e The error raised by the worker.
|
|
62
|
-
* @returns Message of the error.
|
|
63
|
-
*/
|
|
64
|
-
protected handleError(e: Error | string): string;
|
|
65
|
-
/**
|
|
66
|
-
* Run the given function synchronously.
|
|
67
|
-
*
|
|
68
|
-
* @param fn Function that will be executed.
|
|
69
|
-
* @param value Input data for the given function.
|
|
70
|
-
*/
|
|
71
|
-
protected run(fn: (data?: Data) => Response, value: MessageValue<Data>): void;
|
|
72
|
-
/**
|
|
73
|
-
* Run the given function asynchronously.
|
|
74
|
-
*
|
|
75
|
-
* @param fn Function that will be executed.
|
|
76
|
-
* @param value Input data for the given function.
|
|
77
|
-
*/
|
|
78
|
-
protected runAsync(fn: (data?: Data) => Promise<Response>, value: MessageValue<Data>): void;
|
|
79
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Worker } from 'cluster';
|
|
3
|
-
import type { MessageValue } from '../utility-types';
|
|
4
|
-
import { AbstractWorker } from './abstract-worker';
|
|
5
|
-
import type { WorkerOptions } from './worker-options';
|
|
6
|
-
/**
|
|
7
|
-
* A cluster worker used by a poolifier `ClusterPool`.
|
|
8
|
-
*
|
|
9
|
-
* When this worker is inactive for more than the given `maxInactiveTime`,
|
|
10
|
-
* it will send a termination request to its main worker.
|
|
11
|
-
*
|
|
12
|
-
* If you use a `DynamicClusterPool` the extra workers that were created will be terminated,
|
|
13
|
-
* but the minimum number of workers will be guaranteed.
|
|
14
|
-
*
|
|
15
|
-
* @template DataType of data this worker receives from pool's execution. This can only be serializable data.
|
|
16
|
-
* @template ResponseType of response the worker sends back to the main worker. This can only be serializable data.
|
|
17
|
-
* @author [Christopher Quadflieg](https://github.com/Shinigami92)
|
|
18
|
-
* @since 2.0.0
|
|
19
|
-
*/
|
|
20
|
-
export declare class ClusterWorker<Data = unknown, Response = unknown> extends AbstractWorker<Worker, Data, Response> {
|
|
21
|
-
/**
|
|
22
|
-
* Constructs a new poolifier cluster worker.
|
|
23
|
-
*
|
|
24
|
-
* @param fn Function processed by the worker when the pool's `execution` function is invoked.
|
|
25
|
-
* @param opts Options for the worker.
|
|
26
|
-
*/
|
|
27
|
-
constructor(fn: (data: Data) => Response, opts?: WorkerOptions);
|
|
28
|
-
/** @inheritdoc */
|
|
29
|
-
protected sendToMainWorker(message: MessageValue<Response>): void;
|
|
30
|
-
/** @inheritdoc */
|
|
31
|
-
protected handleError(e: Error | string): string;
|
|
32
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { MessagePort } from 'worker_threads';
|
|
3
|
-
import type { MessageValue } from '../utility-types';
|
|
4
|
-
import { AbstractWorker } from './abstract-worker';
|
|
5
|
-
import type { WorkerOptions } from './worker-options';
|
|
6
|
-
/**
|
|
7
|
-
* A thread worker used by a poolifier `ThreadPool`.
|
|
8
|
-
*
|
|
9
|
-
* When this worker is inactive for more than the given `maxInactiveTime`,
|
|
10
|
-
* it will send a termination request to its main thread.
|
|
11
|
-
*
|
|
12
|
-
* If you use a `DynamicThreadPool` the extra workers that were created will be terminated,
|
|
13
|
-
* but the minimum number of workers will be guaranteed.
|
|
14
|
-
*
|
|
15
|
-
* @template DataType of data this worker receives from pool's execution. This can only be serializable data.
|
|
16
|
-
* @template ResponseType of response the worker sends back to the main thread. This can only be serializable data.
|
|
17
|
-
* @author [Alessandro Pio Ardizio](https://github.com/pioardi)
|
|
18
|
-
* @since 0.0.1
|
|
19
|
-
*/
|
|
20
|
-
export declare class ThreadWorker<Data = unknown, Response = unknown> extends AbstractWorker<MessagePort, Data, Response> {
|
|
21
|
-
/**
|
|
22
|
-
* Constructs a new poolifier thread worker.
|
|
23
|
-
*
|
|
24
|
-
* @param fn Function processed by the worker when the pool's `execution` function is invoked.
|
|
25
|
-
* @param opts Options for the worker.
|
|
26
|
-
*/
|
|
27
|
-
constructor(fn: (data: Data) => Response, opts?: WorkerOptions);
|
|
28
|
-
/** @inheritdoc */
|
|
29
|
-
protected sendToMainWorker(message: MessageValue<Response>): void;
|
|
30
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration of kill behaviors.
|
|
3
|
-
*/
|
|
4
|
-
export declare const KillBehaviors: Readonly<{
|
|
5
|
-
/**
|
|
6
|
-
* If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still running, then the worker **wont** be deleted.
|
|
7
|
-
*/
|
|
8
|
-
readonly SOFT: "SOFT";
|
|
9
|
-
/**
|
|
10
|
-
* If `lastActiveTime` is greater than `maxInactiveTime` but a task is still running, then the worker will be deleted.
|
|
11
|
-
*/
|
|
12
|
-
readonly HARD: "HARD";
|
|
13
|
-
}>;
|
|
14
|
-
/**
|
|
15
|
-
* Kill behavior.
|
|
16
|
-
*/
|
|
17
|
-
export declare type KillBehavior = keyof typeof KillBehaviors;
|
|
18
|
-
/**
|
|
19
|
-
* Detects whether the given value is a kill behavior or not.
|
|
20
|
-
*
|
|
21
|
-
* @template KB Which specific KillBehavior to test against.
|
|
22
|
-
* @param killBehavior Which kind of kill behavior to detect.
|
|
23
|
-
* @param value Any value.
|
|
24
|
-
* @returns `true` if `value` was strictly equals to `killBehavior`, otherwise `false`.
|
|
25
|
-
*/
|
|
26
|
-
export declare function isKillBehavior<KB extends KillBehavior>(killBehavior: KB, value: unknown): value is KB;
|
|
27
|
-
/**
|
|
28
|
-
* Options for workers.
|
|
29
|
-
*/
|
|
30
|
-
export interface WorkerOptions {
|
|
31
|
-
/**
|
|
32
|
-
* Maximum waiting time in milliseconds for tasks.
|
|
33
|
-
*
|
|
34
|
-
* After this time, newly created workers will be terminated.
|
|
35
|
-
* The last active time of your worker unit will be updated when a task is submitted to a worker or when a worker terminate a task.
|
|
36
|
-
*
|
|
37
|
-
* - If `killBehavior` is set to `KillBehaviors.HARD` this value represents also the timeout for the tasks that you submit to the pool,
|
|
38
|
-
* when this timeout expires your tasks is interrupted and the worker is killed if is not part of the minimum size of the pool.
|
|
39
|
-
* - If `killBehavior` is set to `KillBehaviors.SOFT` your tasks have no timeout and your workers will not be terminated until your task is completed.
|
|
40
|
-
*
|
|
41
|
-
* @default 60.000 ms
|
|
42
|
-
*/
|
|
43
|
-
maxInactiveTime?: number;
|
|
44
|
-
/**
|
|
45
|
-
* Whether your worker will perform asynchronous or not.
|
|
46
|
-
*
|
|
47
|
-
* @default false
|
|
48
|
-
*/
|
|
49
|
-
async?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* `killBehavior` dictates if your async unit (worker/process) will be deleted in case that a task is active on it.
|
|
52
|
-
*
|
|
53
|
-
* - SOFT: If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still running, then the worker **won't** be deleted.
|
|
54
|
-
* - HARD: If `lastActiveTime` is greater than `maxInactiveTime` but a task is still running, then the worker will be deleted.
|
|
55
|
-
*
|
|
56
|
-
* This option only apply to the newly created workers.
|
|
57
|
-
*
|
|
58
|
-
* @default KillBehaviors.SOFT
|
|
59
|
-
*/
|
|
60
|
-
killBehavior?: KillBehavior;
|
|
61
|
-
}
|