Format & lint

This commit is contained in:
Andras Schmelczer 2025-12-14 13:55:23 +00:00
parent 0e0a85df82
commit 5efe30d9d6
7 changed files with 32 additions and 22 deletions

View file

@ -252,7 +252,7 @@ describe("reset", () => {
await sleep(1);
const secondPromise = locks.withLock(testPath, async () => "second");
void secondPromise.catch(() => { });
void secondPromise.catch(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
locks.reset();
@ -273,7 +273,7 @@ describe("reset", () => {
await sleep(1);
const secondPromise = locks.withLock(testPath, async () => "second");
void secondPromise.catch(() => { });
void secondPromise.catch(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
locks.reset();

View file

@ -13,9 +13,12 @@ export class Locks<T> {
private readonly locked = new Set<T>();
/** Queue of resolve functions waiting for each key */
private readonly waiters = new Map<T, ([() => unknown, (err: unknown) => unknown])[]>();
private readonly waiters = new Map<
T,
[() => unknown, (err: unknown) => unknown][]
>();
public constructor(private readonly logger?: Logger) { }
public constructor(private readonly logger?: Logger) {}
/**
* Executes a function while holding exclusive locks on one or more keys.