X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fabstract-worker.ts;h=cb33188e5778a3c9a31cc30f6ae93cb46b33567c;hb=3d15e8a7b08e6bbe8265793d0fd859d3113c4f4b;hp=c50cfbb081599ed955561edea56a634c93d885ef;hpb=4c35177b63cac8a87aa6de389e1232e94c59b8c9;p=poolifier.git diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index c50cfbb0..cb33188e 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -1,12 +1,13 @@ import { AsyncResource } from 'async_hooks' import type { Worker } from 'cluster' import type { MessagePort } from 'worker_threads' -import type { MessageValue } from '../utility-types' +import type { MessageValue, KillBehavior } from '../utility-types' import type { WorkerOptions } from './worker-options' -import { killBehaviorEnumeration } from './worker-options' +// import { killBehaviorEnumeration } from './worker-options' const defaultMaxInactiveTime = 1000 * 60 -const defaultKillBehavior = killBehaviorEnumeration.SOFT +// TODO fix this and avoid that SOFT/HARD words are replicated so much times into the project +const defaultKillBehavior: KillBehavior = 'SOFT' /** * Base class containing some shared logic for all poolifier workers. @@ -27,7 +28,7 @@ export abstract class AbstractWorker< /** * The kill behavior set as option on the Worker constructor or a default value. */ - protected readonly killBehavior: string + protected readonly killBehavior: KillBehavior /** * Whether the worker is working asynchronously or not. */