From fd32a55ccefa59f6795a798f869a29f8fa1bb0c6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 12 Oct 2024 12:15:29 +0200 Subject: [PATCH] fix: PoolBase kClose and kDestroy should await and not return the Promise (#3716) (#3723) (cherry picked from commit cda5f94f87c0462f3be11fa9d5dad88550881c6c) Co-authored-by: Aras Abbasi --- 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) {