From 07a6e2b5fe1d4044f031f23c14bf5c8c5f699d0f Mon Sep 17 00:00:00 2001 From: Sergii Bondarenko Date: Mon, 26 Oct 2020 17:11:42 +0200 Subject: [PATCH] Fixes #3445: Close timers after resolving/erroring the `dns.*` promises --- src/drivers/npm/driver.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index a715363e8..75e658054 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -637,17 +637,16 @@ class Site { // DNS if (!this.dns.length) { const records = {} - const resolve = async (func, hostname) => { - try { - return await this.promiseTimeout(func(hostname)) - } catch (error) { - if (error.code !== 'ENODATA') { - this.error(error) - } + return this.promiseTimeout( + func(hostname).catch((error) => { + if (error.code !== 'ENODATA') { + this.error(error) + } - return [] - } + return [] + }) + ) } const domain = url.hostname.replace(/^www\./, '')