From: Jérôme Benoit Date: Mon, 29 May 2023 12:44:23 +0000 (+0200) Subject: refactor: cleanup async lock acquire() X-Git-Tag: v1.2.15~10 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=acf727c70f6f0f63fc0aef528423e52553445ed3;p=e-mobility-charging-stations-simulator.git refactor: cleanup async lock acquire() Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/AsyncLock.ts b/src/utils/AsyncLock.ts index 229086fe..cf0443b2 100644 --- a/src/utils/AsyncLock.ts +++ b/src/utils/AsyncLock.ts @@ -19,11 +19,11 @@ export class AsyncLock { const asyncLock = AsyncLock.getAsyncLock(type); if (!asyncLock.acquired) { asyncLock.acquired = true; - } else { - return new Promise((resolve) => { - asyncLock.resolveQueue.push(resolve); - }); + return; } + return new Promise((resolve) => { + asyncLock.resolveQueue.push(resolve); + }); } public static async release(type: AsyncLockType): Promise {