From d467756c6bffa394dc17e9a54b97a3679e9a512a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 26 Jul 2023 00:02:04 +0200 Subject: [PATCH] docs: refine code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStationUtils.ts | 4 +++- src/utils/Utils.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 0eeb2051..23b42d5c 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -672,8 +672,10 @@ interface ChargingProfilesLimit { } /** - * Charging profiles should already be sorted by connector id and stack level (highest stack level has priority) + * Charging profiles shall already be sorted by connector id and stack level (highest stack level has priority) * + * @param chargingStation - + * @param connectorId - * @param chargingProfiles - * @param logPrefix - * @returns ChargingProfilesLimit diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 54b07510..48d0587c 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -262,11 +262,12 @@ export const insertAt = (str: string, subStr: string, pos: number): string => * Computes the retry delay in milliseconds using an exponential backoff algorithm. * * @param retryNumber - the number of retries that have already been attempted + * @param maxDelayRatio - the maximum ratio of the delay that can be randomized * @returns delay in milliseconds */ export const exponentialDelay = (retryNumber = 0, maxDelayRatio = 0.2): number => { const delay = Math.pow(2, retryNumber) * 100; - const randomSum = delay * maxDelayRatio * secureRandom(); // 0-20% of the delay + const randomSum = delay * maxDelayRatio * secureRandom(); // 0-(maxDelayRatio*100)% of the delay return delay + randomSum; }; -- 2.34.1