From: Jérôme Benoit Date: Tue, 31 Mar 2026 20:14:39 +0000 (+0200) Subject: fix(auth): use Math.floor for TTL computation to avoid serving expired cache entries X-Git-Tag: ocpp-server@v4.1.0~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=77867a7bcac8d9b7aaee938e48cac7b0038a2ffd;p=e-mobility-charging-stations-simulator.git fix(auth): use Math.floor for TTL computation to avoid serving expired cache entries --- diff --git a/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts b/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts index 483e331a..f8f7d3d9 100644 --- a/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts +++ b/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts @@ -563,7 +563,7 @@ export class OCPPAuthServiceImpl implements OCPPAuthService { if (expiryDate != null) { const expiry = convertToDate(expiryDate) if (expiry != null) { - const ttlSeconds = Math.ceil((expiry.getTime() - Date.now()) / 1000) + const ttlSeconds = Math.floor((expiry.getTime() - Date.now()) / 1000) if (ttlSeconds <= 0) { logger.debug( `${this.chargingStation.logPrefix()} ${moduleName}.updateCacheEntry: Skipping expired entry for ${truncateId(identifier)}`