Add timeout on update of OCPP params
MODIFY
src/migration/tasks/UpdateChargingStationTemplatesTask.ts
src/migration/tasks/UpdateChargingStationTemplatesTask.ts
@@ -2,6 +2,7 @@ import ChargingStationStorage from '../../storage/mongodb/ChargingStationStorage
import Constants from '../../utils/Constants';
import Logging from '../../utils/Logging';
import MigrationTask from '../MigrationTask';
+import { OCPPChangeConfigurationCommandResult } from '../../types/ocpp/OCPPClient';
import OCPPUtils from '../../server/ocpp/utils/OCPPUtils';
import { ServerAction } from '../../types/Server';
import { TemplateUpdateResult } from '../../types/ChargingStation';
@@ -63,7 +64,7 @@ export default class UpdateChargingStationTemplatesTask extends MigrationTask {
action: ServerAction.UPDATE_CHARGING_STATION_WITH_TEMPLATE,
source: chargingStation.id,
module: MODULE_NAME, method: 'applyTemplateToChargingStations',
- message: `Migrate '${chargingStation.id}' in Tenant '${tenant.name}'`,
+ message: `Migrate '${chargingStation.id}' in Tenant '${tenant.name}' ('${tenant.subdomain}'`,
});
const chargingStationTemplateUpdated = await Utils.promiseWithTimeout<TemplateUpdateResult>(
60 * 1000, OCPPUtils.enrichChargingStationWithTemplate(tenant.id, chargingStation),
@@ -85,8 +86,10 @@ export default class UpdateChargingStationTemplatesTask extends MigrationTask {
await ChargingStationStorage.saveChargingStation(tenant.id, chargingStation);
updated++;
// Retrieve OCPP params and update them if needed
- await OCPPUtils.requestAndSaveChargingStationOcppParameters(
- tenant.id, chargingStation, chargingStationTemplateUpdated.ocppUpdated);
+ await Utils.promiseWithTimeout<OCPPChangeConfigurationCommandResult>(
+ 60 * 1000, OCPPUtils.requestAndSaveChargingStationOcppParameters(
+ tenant.id, chargingStation, chargingStationTemplateUpdated.ocppUpdated),
+ `Time out error with ${chargingStation.id}`);
}
} catch (error) {
Logging.logError({

Add timeout on update of OCPP params