From eff81eb7ffd356957fa8d19a235b850378267cfd Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 15 Dec 2024 20:19:25 +0100 Subject: [PATCH] Add timeout delay --- lib/time.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/time.js b/lib/time.js index b6c962eca..cce8f7566 100644 --- a/lib/time.js +++ b/lib/time.js @@ -141,7 +141,9 @@ function timeoutPromise (timeout) { // if no timeout is specified, never settle if (!timeout) return - setTimeout(() => reject(new TimeoutError(timeout)), timeout) + // delay timeout by 100ms so any parallel promise with same timeout will throw first + const delay = 100 + setTimeout(() => reject(new TimeoutError(timeout)), timeout + delay) }) }