Decorrelate long run OCPI get tokens for differential one (every hour)
MODIFY
src/locking/LockingHelper.ts
src/locking/LockingHelper.ts
@@ -62,8 +62,8 @@ export default class LockingHelper {
return lock;
}
- public static async createOCPIPullEmspTokensLock(tenantID: string, ocpiEndpoint: OCPIEndpoint): Promise<Lock|null> {
- return LockingHelper.createOCPIEndpointActionLock(tenantID, ocpiEndpoint, 'pull-emsp-tokens');
+ public static async createOCPIPullEmspTokensLock(tenantID: string, ocpiEndpoint: OCPIEndpoint, partial: boolean): Promise<Lock|null> {
+ return LockingHelper.createOCPIEndpointActionLock(tenantID, ocpiEndpoint, `pull-emsp-tokens${partial ? '-partial' : ''}`);
}
public static async createOCPICheckCpoCdrsLock(tenantID: string, ocpiEndpoint: OCPIEndpoint): Promise<Lock|null> {

MODIFY
src/scheduler/tasks/ocpi/OCPIGetTokensTask.ts
src/scheduler/tasks/ocpi/OCPIGetTokensTask.ts
@@ -37,7 +37,7 @@ export default class OCPIGetTokensTask extends SchedulerTask {
private async processOCPIEndpoint(tenant: Tenant, ocpiEndpoint: OCPIEndpoint, config: OCPIGetTokensTaskConfig): Promise<void> {
// Get the lock
- const ocpiLock = await LockingHelper.createOCPIPullEmspTokensLock(tenant.id, ocpiEndpoint);
+ const ocpiLock = await LockingHelper.createOCPIPullEmspTokensLock(tenant.id, ocpiEndpoint, config.partial);
if (ocpiLock) {
try {
// Check if OCPI endpoint is registered

MODIFY
src/server/rest/v1/service/OCPIEndpointService.ts
src/server/rest/v1/service/OCPIEndpointService.ts
@@ -363,7 +363,7 @@ export default class OCPIEndpointService {
MODULE_NAME, 'handlePullTokensEndpoint', req.user);
const tenant = await TenantStorage.getTenant(req.user.tenantID);
// Get the lock
- const ocpiLock = await LockingHelper.createOCPIPullEmspTokensLock(tenant.id, ocpiEndpoint);
+ const ocpiLock = await LockingHelper.createOCPIPullEmspTokensLock(tenant.id, ocpiEndpoint, false);
if (!ocpiLock) {
throw new AppError({
source: Constants.CENTRAL_SERVER,

Decorrelate long run OCPI get tokens for differential one (every hour)