X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FAsyncLock.ts;h=f6b793a60748beaa8454fdb80e13510553a25898;hb=90dc299a5f5c9990aa52911b2d8fdc401776972f;hp=c6b35b84457fa9f090b002417e4cbdfeb32cfb5e;hpb=a223d9be48ad8828e6aef060dd3c45d4f99ea9a9;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/AsyncLock.ts b/src/utils/AsyncLock.ts index c6b35b84..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' @@ -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() })