Skip to content

Commit ea75e46

Browse files
tomaioofirecow
andauthored
fix: system-wide deadlock (#1905)
Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com> Co-authored-by: Mads Jon Nielsen <madsjon@gmail.com>
1 parent a5bb1a3 commit ea75e46

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/mutex.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ export class Mutex {
1616
static async exclusive (key: string, cb: () => Promise<void>) {
1717
await Mutex.waitForLock(key);
1818
Mutex.locks.add(key);
19-
await cb();
20-
Mutex.locks.delete(key);
19+
try {
20+
await cb();
21+
} finally {
22+
Mutex.locks.delete(key);
23+
}
2124
}
2225

2326
}

0 commit comments

Comments
 (0)