X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerTypes.ts;h=faf327dbede39d111c139d32b8dcd313d2981381;hb=5a15db9001b93665ab7581d2974c5f01a9e0fbe3;hp=806808d8a6fb020d2be7414b8d3848097de883bf;hpb=1d8f226b47637e80c74106799208da5df93b2a04;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerTypes.ts b/src/worker/WorkerTypes.ts index 806808d8..faf327db 100644 --- a/src/worker/WorkerTypes.ts +++ b/src/worker/WorkerTypes.ts @@ -1,58 +1,61 @@ -import type { Worker } from 'node:worker_threads'; +import type { Worker } from 'node:worker_threads' -import { type PoolEvent, PoolEvents, type ThreadPoolOptions } from 'poolifier'; +import { type PoolEvent, PoolEvents, type ThreadPoolOptions } from 'poolifier' export enum WorkerProcessType { workerSet = 'workerSet', /** @experimental */ dynamicPool = 'dynamicPool', - fixedPool = 'fixedPool', + fixedPool = 'fixedPool' } export interface SetInfo { - version: string; - type: string; - worker: string; - size: number; - elementsExecuting: number; - elementsPerWorker: number; + version: string + type: string + worker: string + size: number + elementsExecuting: number + elementsPerWorker: number } export enum WorkerSetEvents { + started = 'started', + stopped = 'stopped', error = 'error', elementStarted = 'elementStarted', - elementError = 'elementError', + elementError = 'elementError' } export const WorkerEvents = { ...PoolEvents, - ...WorkerSetEvents, -} as const; -export type WorkerEvents = PoolEvent | WorkerSetEvents; + ...WorkerSetEvents +} as const +// eslint-disable-next-line @typescript-eslint/no-redeclare +export type WorkerEvents = PoolEvent | WorkerSetEvents export interface WorkerOptions { - workerStartDelay?: number; - elementStartDelay?: number; - poolMaxSize: number; - poolMinSize: number; - elementsPerWorker?: number; - poolOptions?: ThreadPoolOptions; + workerStartDelay?: number + elementStartDelay?: number + poolMaxSize: number + poolMinSize: number + elementsPerWorker?: number + poolOptions?: ThreadPoolOptions } -export type WorkerData = Record; +export type WorkerData = Record export interface WorkerSetElement { - worker: Worker; - numberOfWorkerElements: number; + worker: Worker + numberOfWorkerElements: number } export interface WorkerMessage { - event: WorkerMessageEvents; - data: T; + event: WorkerMessageEvents + data: T } export enum WorkerMessageEvents { startWorkerElement = 'startWorkerElement', startWorkerElementError = 'startWorkerElementError', - startedWorkerElement = 'startedWorkerElement', + startedWorkerElement = 'startedWorkerElement' }