Skip to content

Commit 889d231

Browse files
committed
small improvement
1 parent 431e7c1 commit 889d231

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

misc/async_disposable_stack.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ export class AsyncDisposableStack implements AsyncDisposable {
1414
}
1515
async [Symbol.asyncDispose](): Promise<void> {
1616
const errors = [];
17-
for (const callback of this.#callbacks.reverse()) {
17+
for (const callback of [...this.#callbacks].reverse()) {
1818
try {
1919
await callback();
2020
} catch (error) {
2121
errors.push(error);
2222
}
2323
}
24+
this.#callbacks = [];
2425
switch (errors.length) {
2526
case 0:
2627
break;

0 commit comments

Comments
 (0)