X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fworker-options.ts;h=75d3dd5b98bf1d8e633d3b58c0190cd3c1f20f93;hb=c2d2417cb80d8c14637fe6a19d58bcf5ce18ae98;hp=b71a90e5817b6304c2b19a745127c47bbaff7ac2;hpb=8d1e1b3b417d37460c091ec8db3ac862201a244e;p=poolifier.git diff --git a/src/worker/worker-options.ts b/src/worker/worker-options.ts index b71a90e5..75d3dd5b 100644 --- a/src/worker/worker-options.ts +++ b/src/worker/worker-options.ts @@ -3,11 +3,11 @@ */ export const KillBehaviors = Object.freeze({ /** - * If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing, then the worker **wont** be deleted. + * If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing or queued, then the worker **wont** be deleted. */ SOFT: 'SOFT', /** - * If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing, then the worker will be deleted. + * If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing or queued, then the worker will be deleted. */ HARD: 'HARD' } as const) @@ -17,21 +17,6 @@ export const KillBehaviors = Object.freeze({ */ export type KillBehavior = keyof typeof KillBehaviors -/** - * Detects whether the given value is a kill behavior or not. - * - * @typeParam KB - Which specific KillBehavior type to test against. - * @param killBehavior - Which kind of kill behavior to detect. - * @param value - Any value. - * @returns `true` if `value` was strictly equals to `killBehavior`, otherwise `false`. - */ -export const isKillBehavior = ( - killBehavior: KB, - value: unknown -): value is KB => { - return value === killBehavior -} - /** * Options for workers. */ @@ -59,8 +44,8 @@ export interface WorkerOptions { /** * `killBehavior` dictates if your async unit (worker/process) will be deleted in case that a task is active on it. * - * - SOFT: If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing, then the worker **won't** be deleted. - * - HARD: If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing, then the worker will be deleted. + * - SOFT: If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing or queued, then the worker **won't** be deleted. + * - HARD: If `currentTime - lastActiveTime` is greater than `maxInactiveTime` but a task is still executing or queued, then the worker will be deleted. * * This option only apply to the newly created workers. *