import chalk from 'chalk';
import { availableParallelism } from 'poolifier';
-import { waitChargingStationEvents } from './ChargingStationUtils';
+import { waitChargingStationEvents } from './Helpers';
import type { AbstractUIServer } from './ui-server/AbstractUIServer';
import { UIServerFactory } from './ui-server/UIServerFactory';
import { version } from '../../package.json' assert { type: 'json' };
public async start(): Promise<void> {
if (!isMainThread) {
- throw new Error('Cannot start charging stations simulator from worker thread');
+ throw new BaseError('Cannot start charging stations simulator from worker thread');
}
if (this.started === false) {
if (this.starting === false) {
public async stop(): Promise<void> {
if (!isMainThread) {
- throw new Error('Cannot stop charging stations simulator from worker thread');
+ throw new BaseError('Cannot stop charging stations simulator from worker thread');
}
if (this.started === true) {
if (this.stopping === false) {
if (workerConfiguration?.elementsPerWorker === 'auto') {
elementsPerWorker =
this.numberOfChargingStations > availableParallelism()
- ? Math.round(this.numberOfChargingStations / availableParallelism())
+ ? Math.round(this.numberOfChargingStations / (availableParallelism() * 1.5))
: 1;
}
this.workerImplementation === null &&