Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Simplify some code logic
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
  • Loading branch information
Jérôme Benoit committed Feb 9, 2022
1 parent 74c6a95 commit 6114e6f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/charging-station/ChargingStation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,6 @@ export default class ChargingStation {
}
} while (!this.isInAcceptedState() && (registrationRetryCount <= this.getRegistrationMaxRetries() || this.getRegistrationMaxRetries() === -1));
}
if (this.isInAcceptedState() && this.stationInfo.autoRegister) {
await this.ocppRequestService.sendBootNotification(this.bootNotificationRequest.chargePointModel,
this.bootNotificationRequest.chargePointVendor, this.bootNotificationRequest.chargeBoxSerialNumber, this.bootNotificationRequest.firmwareVersion);
}
if (this.isInAcceptedState()) {
await this.startMessageSequence();
this.stopped && (this.stopped = false);
Expand Down Expand Up @@ -878,6 +874,10 @@ export default class ChargingStation {
}

private async startMessageSequence(): Promise<void> {
if (this.stationInfo.autoRegister) {
await this.ocppRequestService.sendBootNotification(this.bootNotificationRequest.chargePointModel,
this.bootNotificationRequest.chargePointVendor, this.bootNotificationRequest.chargeBoxSerialNumber, this.bootNotificationRequest.firmwareVersion);
}
// Start WebSocket ping
this.startWebSocketPing();
// Start heartbeat
Expand Down
2 changes: 1 addition & 1 deletion src/charging-station/ocpp/OCPPIncomingRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default abstract class OCPPIncomingRequestService {
}

protected handleIncomingRequestError<T>(commandName: IncomingRequestCommand, error: Error, errorOcppResponse?: T): T {
logger.error(this.chargingStation.logPrefix() + ' Incoming request command ' + commandName + ' error: %j', error);
logger.error(this.chargingStation.logPrefix() + ' Incoming request command %s error: %j', commandName, error);
if (errorOcppResponse) {
return errorOcppResponse;
}
Expand Down
2 changes: 1 addition & 1 deletion src/charging-station/ocpp/OCPPRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default abstract class OCPPRequestService {
}

protected handleRequestError(commandName: RequestCommand, error: Error): void {
logger.error(this.chargingStation.logPrefix() + ' Request command ' + commandName + ' error: %j', error);
logger.error(this.chargingStation.logPrefix() + ' Request command %s error: %j', commandName, error);
throw error;
}

Expand Down
1 change: 0 additions & 1 deletion src/types/ConfigurationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ServerOptions } from 'ws';
import { StorageType } from './Storage';
import type { WorkerChoiceStrategy } from 'poolifier';
import { WorkerProcessType } from './Worker';
import { level } from 'winston';

export enum SupervisionUrlDistribution {
ROUND_ROBIN = 'round-robin',
Expand Down
1 change: 0 additions & 1 deletion src/utils/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { WorkerChoiceStrategy } from 'poolifier';
import { WorkerProcessType } from '../types/Worker';
import chalk from 'chalk';
import fs from 'fs';
import { level } from 'winston';
import path from 'path';

export default class Configuration {
Expand Down

0 comments on commit 6114e6f

Please sign in to comment.