Increase OCPI local push of tokens
MODIFY
src/client/ocpi/EmspOCPIClient.ts
src/client/ocpi/EmspOCPIClient.ts
@@ -68,7 +68,8 @@ export default class EmspOCPIClient extends OCPIClient {
// Get all tokens
tokens = await OCPIUtilsService.getTokens(
this.tenant, Constants.DB_RECORD_COUNT_DEFAULT, currentSkip);
- for (const token of tokens.result) {
+ if (!Utils.isEmptyArray(tokens.result)) {
+ await Promise.map(tokens.result, async (token: OCPIToken) => {
result.total++;
try {
await this.pushToken(token);
@@ -80,6 +81,8 @@ export default class EmspOCPIClient extends OCPIClient {
`Failed to update Token ID '${token.uid}': ${error.message}`
);
}
+ },
+ { concurrency: Constants.OCPI_MAX_PARALLEL_REQUESTS });
}
currentSkip += Constants.DB_RECORD_COUNT_DEFAULT;
} while (!Utils.isEmptyArray(tokens.result));

MODIFY
src/utils/Constants.ts
src/utils/Constants.ts
@@ -236,6 +236,7 @@ export default class Constants {
public static readonly OCPI_SERVER = 'OCPI Server';
public static readonly OCPI_SEPARATOR = '*';
public static readonly OCPI_RECORDS_LIMIT = 25;
+ public static readonly OCPI_MAX_PARALLEL_REQUESTS = 5;
public static readonly OICP_SERVER = 'OICP Server';

Increase OCPI local push of tokens