fix: restore WaitTask terminate condition (#9612)

This commit is contained in:
ggorlen 2023-02-01 00:10:02 -08:00 committed by GitHub
parent 40068a7d86
commit e16cbc6626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,10 +177,11 @@ export class WaitTask<T = unknown> {
async terminate(error?: unknown): Promise<void> {
this.#world.taskManager.delete(this);
if (error && !this.#result.finished()) {
if (this.#timeout) {
clearTimeout(this.#timeout);
}
if (error && !this.#result.finished()) {
this.#result.reject(error);
}