import { ThreadWorker } from 'poolifier';
import { ChargingStation } from './ChargingStation';
+import { BaseError } from '../exception';
import type { ChargingStationWorkerData } from '../types';
import { Configuration } from '../utils';
-import { WorkerConstants, type WorkerMessage, WorkerMessageEvents } from '../worker';
+import { POOL_MAX_INACTIVE_TIME, type WorkerMessage, WorkerMessageEvents } from '../worker';
const moduleName = 'ChargingStationWorker';
}
break;
default:
- throw new Error(
+ throw new BaseError(
`Unknown worker event: '${message.event}' received with data: '${JSON.stringify(
message.data,
null,
export let chargingStationWorker: ChargingStationWorker | ThreadWorker<ChargingStationWorkerData>;
if (Configuration.workerPoolInUse()) {
chargingStationWorker = new ThreadWorker<ChargingStationWorkerData>(startChargingStation, {
- maxInactiveTime: WorkerConstants.POOL_MAX_INACTIVE_TIME,
+ maxInactiveTime: POOL_MAX_INACTIVE_TIME,
});
} else {
chargingStationWorker = new ChargingStationWorker();