Removed setTimeout call of triggerSmartCharging in SiteAreaService
Disable both Async and Scheduler's tasks when tenant.redirectDomain is provided
MODIFY
src/async-task/TenantAsyncTask.ts
src/async-task/TenantAsyncTask.ts
@@ -16,6 +16,11 @@ export default abstract class TenantAsyncTask extends AbstractAsyncTask {
const tenants = await TenantStorage.getTenants({}, Constants.DB_PARAMS_MAX_LIMIT);
// Process them
for (const tenant of tenants.result) {
+ // Check if redirect domain is provided
+ if (tenant.redirectDomain) {
+ // Ignore this tenant
+ continue;
+ }
const tenantCorrelationID = Utils.generateShortNonUniqueID();
const startTimeInTenant = moment();
await Logging.logDebug({

MODIFY
src/scheduler/TenantSchedulerTask.ts
src/scheduler/TenantSchedulerTask.ts
@@ -16,6 +16,11 @@ export default abstract class TenantSchedulerTask extends SchedulerTask {
const tenants = await TenantStorage.getTenants({}, Constants.DB_PARAMS_MAX_LIMIT);
// Process them
for (const tenant of tenants.result) {
+ // Check if redirect domain is provided
+ if (tenant.redirectDomain) {
+ // Ignore this tenant
+ continue;
+ }
const tenantCorrelationID = Utils.generateShortNonUniqueID();
const startTimeInTenant = moment();
await Logging.logDebug({

MODIFY
src/server/rest/v1/service/SiteAreaService.ts
src/server/rest/v1/service/SiteAreaService.ts
@@ -408,7 +408,7 @@ export default class SiteAreaService {
req.tenant, siteArea, { profilePurposeType: ChargingProfilePurposeType.TX_PROFILE });
}
// Retrigger Smart Charging
- SiteAreaService.triggerSmartCharging(req.tenant, action, siteArea);
+ void SiteAreaService.triggerSmartCharging(req.tenant, action, siteArea);
await Logging.logInfo({
...LoggingHelper.getSiteAreaProperties(siteArea),
tenantID: req.tenant.id,
@@ -477,10 +477,8 @@ export default class SiteAreaService {
}
}
- private static triggerSmartCharging(tenant: Tenant, action: ServerAction, siteArea: SiteArea) {
+ private static async triggerSmartCharging(tenant: Tenant, action: ServerAction, siteArea: SiteArea) {
if (siteArea.smartCharging) {
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
- setTimeout(async () => {
const siteAreaLock = await LockingHelper.acquireSiteAreaSmartChargingLock(tenant.id, siteArea);
if (siteAreaLock) {
try {
@@ -500,7 +498,6 @@ export default class SiteAreaService {
await LockingManager.release(siteAreaLock);
}
}
- }, Constants.DELAY_SMART_CHARGING_EXECUTION_MILLIS);
}
}

Removed setTimeout call of triggerSmartCharging in SiteAreaService
Disable both Async and Scheduler's tasks when tenant.redirectDomain is provided