X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FAsyncLock.ts;h=f6b793a60748beaa8454fdb80e13510553a25898;hb=1d41bc6b533ef7361954f472811263c24cd6f64b;hp=b58e3a77eb780a8e4836f7150658ad8268dd6233;hpb=a807045be19c1ed4996a44d8c2c8774e926dc6dc;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/AsyncLock.ts b/src/utils/AsyncLock.ts index b58e3a77..f6b793a6 100644 --- a/src/utils/AsyncLock.ts +++ b/src/utils/AsyncLock.ts @@ -1,4 +1,4 @@ -// Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. +// Partial Copyright Jerome Benoit. 2021-2024. All Rights Reserved. import { Queue } from 'mnemonist' @@ -6,7 +6,7 @@ import { Constants } from './Constants.js' export enum AsyncLockType { configuration = 'configuration', - performance = 'performance', + performance = 'performance' } type ResolveType = (value: void | PromiseLike) => void @@ -35,7 +35,7 @@ export class AsyncLock { asyncLock.acquired = true return } - await new Promise((resolve) => { + await new Promise(resolve => { asyncLock.resolveQueue.enqueue(resolve) }) } @@ -48,7 +48,7 @@ export class AsyncLock { } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const queuedResolve = asyncLock.resolveQueue.dequeue()! - await new Promise((resolve) => { + await new Promise(resolve => { queuedResolve() resolve() })