X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Futils%2FAsyncLock.ts;h=f6b793a60748beaa8454fdb80e13510553a25898;hb=fa7eddeb9853f81302da6141f5b7286f729e4023;hp=b58e3a77eb780a8e4836f7150658ad8268dd6233;hpb=a7d26b50a4e78fdad0da2f02c32b889fd82c94f0;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() })