From 283526a9cbfbffc7da83bf484ed0b896f31ab84b Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Thu, 10 Oct 2024 22:50:06 +0200 Subject: [PATCH] fix: PoolBase kClose and kDestroy should await and not return the Promise --- lib/dispatcher/pool-base.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/dispatcher/pool-base.js b/lib/dispatcher/pool-base.js index ff3108a4da2..d0ba2c3c53a 100644 --- a/lib/dispatcher/pool-base.js +++ b/lib/dispatcher/pool-base.js @@ -113,9 +113,9 @@ class PoolBase extends DispatcherBase { async [kClose] () { if (this[kQueue].isEmpty()) { - return Promise.all(this[kClients].map(c => c.close())) + await Promise.all(this[kClients].map(c => c.close())) } else { - return new Promise((resolve) => { + await new Promise((resolve) => { this[kClosedResolve] = resolve }) } @@ -130,7 +130,7 @@ class PoolBase extends DispatcherBase { item.handler.onError(err) } - return Promise.all(this[kClients].map(c => c.destroy(err))) + await Promise.all(this[kClients].map(c => c.destroy(err))) } [kDispatch] (opts, handler) {