8000 Improve async · microsoft/vscode-python@2047861 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2047861

Browse files
author
Kartik Raj
committed
Improve async
1 parent f531b28 commit 2047861

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/client/common/utils/async.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,17 @@ class DeferredImpl<T> implements Deferred<T> {
5050
}
5151

5252
public resolve(_value: T | PromiseLike<T>) {
53+
if (this.completed) {
54+
return;
55+
}
5356
this._resolve.apply(this.scope ? this.scope : this, [_value]);
5457
this._resolved = true;
5558
}
5659

5760
public reject(_reason?: string | Error | Record<string, unknown>) {
61+
if (this.completed) {
62+
return;
63+
}
5864
this._reject.apply(this.scope ? this.scope : this, [_reason]);
5965
this._rejected = true;
6066
}

0 commit comments

Comments
 (0)
0