fix: uncaught synchronous exception in AsyncMutex

This commit is contained in:
Pujit Mehrotra
2025-09-09 10:42:33 -04:00
parent 5b33e90ed5
commit e1bbe0ca47

View File

@@ -137,8 +137,7 @@ export class AsyncMutex<T = unknown> {
}
const op = (operation || this.defaultOperation) as AsyncOperation<U | T>;
const promise = op().finally(() => {
const promise = Promise.resolve().then(op).finally(() => {
if (this.currentOperation === promise) {
this.currentOperation = null;
}