X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=59610667ef063bbc0c8801d420729c6135d3690f;hb=3e8d029bbd0a072ae80c45e9a50770de3218cbc1;hp=7d8eebd55204d129a0d25f554ab71dad017414a9;hpb=361c98f57255e5b91d123d5f2ba43ab533134b1a;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 7d8eebd5..59610667 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -1,8 +1,8 @@ -import type EventEmitterAsyncResource from 'node:events'; -import fs from 'node:fs'; +import type { EventEmitter } from 'node:events'; +import { existsSync } from 'node:fs'; import type { Worker } from 'node:worker_threads'; -import type { ErrorHandler, ExitHandler, PoolInfo } from 'poolifier'; +import type { ErrorHandler, ExitHandler, PoolEmitter, PoolInfo } from 'poolifier'; import { WorkerConstants } from './WorkerConstants'; import type { SetInfo, WorkerData, WorkerOptions } from './WorkerTypes'; @@ -14,7 +14,7 @@ export abstract class WorkerAbstract { public abstract readonly info: PoolInfo | SetInfo; public abstract readonly size: number; public abstract readonly maxElementsPerWorker: number | undefined; - public abstract readonly emitter: EventEmitterAsyncResource | undefined; + public abstract readonly emitter: EventEmitter | PoolEmitter | undefined; /** * `WorkerAbstract` constructor. @@ -39,7 +39,7 @@ export abstract class WorkerAbstract { if (typeof workerScript === 'string' && workerScript.trim().length === 0) { throw new Error('Worker script is empty'); } - if (!fs.existsSync(workerScript)) { + if (!existsSync(workerScript)) { throw new Error('Worker script file does not exist'); } this.workerScript = workerScript;