diff --git a/src/util/DeferredPromise.ts b/src/util/DeferredPromise.ts index a91f5d9672c..b6be161e379 100644 --- a/src/util/DeferredPromise.ts +++ b/src/util/DeferredPromise.ts @@ -31,10 +31,13 @@ export function createDeferredPromiseWithTimer( resolver = resolve; rejector = reject; }); - const timeoutId = setTimeout(() => { - isRejected = true; - rejector(new TimeoutError(timeoutMessage)); - }, timeout); + const timeoutId = + timeout > 0 + ? setTimeout(() => { + isRejected = true; + rejector(new TimeoutError(timeoutMessage)); + }, timeout) + : undefined; return Object.assign(taskPromise, { resolved: () => { return isResolved;