Renaming in Utils
MODIFY
src/integration/asset/schneider/SchneiderAssetIntegration.ts
src/integration/asset/schneider/SchneiderAssetIntegration.ts
@@ -24,7 +24,7 @@ export default class SchneiderAssetIntegration extends AssetIntegration<AssetSet
params.append('username', this.connection.connection.user);
params.append('password', Cypher.decrypt(this.connection.connection.password));
// Send credentials to get the token
- await Utils.promiseWithTimeout(5000,
+ await Utils.executePromiseWithTimeout(5000,
axios.post(`${this.connection.url}/GetToken`, params, {
headers: this.buildFormHeaders()
}),

MODIFY
src/migration/tasks/UpdateChargingStationTemplatesTask.ts
src/migration/tasks/UpdateChargingStationTemplatesTask.ts
@@ -104,7 +104,7 @@ export default class UpdateChargingStationTemplatesTask extends MigrationTask {
message: `Apply Template's OCPP Parameters for '${chargingStation.id}' in Tenant '${tenant.name}' ('${tenant.subdomain}')`,
});
// Request the latest configuration
- const result = await Utils.promiseWithTimeout<OCPPChangeConfigurationCommandResult>(
+ const result = await Utils.executePromiseWithTimeout<OCPPChangeConfigurationCommandResult>(
60 * 1000, OCPPUtils.requestAndSaveChargingStationOcppParameters(tenant.id, chargingStation),
'Time out error (60s) in requesting OCPP params');
if (result.status !== OCPPConfigurationStatus.ACCEPTED) {
@@ -118,7 +118,7 @@ export default class UpdateChargingStationTemplatesTask extends MigrationTask {
continue;
}
// Update the OCPP parameters from the template
- const updatedOcppParameters = await Utils.promiseWithTimeout<ActionsResponse>(
+ const updatedOcppParameters = await Utils.executePromiseWithTimeout<ActionsResponse>(
60 * 1000, OCPPUtils.updateChargingStationTemplateOcppParameters(tenant.id, chargingStation),
'Time out error (60s) in updating OCPP Parameters');
// Log

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -69,7 +69,7 @@ export default class Utils {
return intervalMins;
}
- public static async promiseWithTimeout<T>(timeoutMs: number, promise: Promise<T>, failureMessage: string): Promise<T> {
+ public static async executePromiseWithTimeout<T>(timeoutMs: number, promise: Promise<T>, failureMessage: string): Promise<T> {
let timeoutHandle;
const timeoutPromise = new Promise<never>((resolve, reject) => {
timeoutHandle = setTimeout(() => reject(new Error(failureMessage)), timeoutMs);

Renaming in Utils