import { ThreadWorker } from 'poolifier';
import { ChargingStation } from './ChargingStation';
-import { ChargingStationUtils } from './ChargingStationUtils';
import type { ChargingStationWorkerData } from '../types';
-import { Utils } from '../utils';
+import { Configuration } from '../utils';
import { WorkerConstants, type WorkerMessage, WorkerMessageEvents } from '../worker';
/**
// Conditionally export ThreadWorker instance for pool usage
export let threadWorker: ThreadWorker;
-if (ChargingStationUtils.workerPoolInUse()) {
+if (Configuration.workerPoolInUse()) {
threadWorker = new ThreadWorker<ChargingStationWorkerData>(startChargingStation, {
maxInactiveTime: WorkerConstants.POOL_MAX_INACTIVE_TIME,
- async: false,
});
} else {
// Add message listener to start charging station from main thread
addMessageListener();
- if (Utils.isUndefined(workerData) === false) {
+ if (workerData !== undefined) {
startChargingStation(workerData as ChargingStationWorkerData);
}
}