From 65d71e5db0653361c55e191313e491269f6b61af Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 18 Jul 2022 23:14:16 +0800 Subject: [PATCH] Fix mssqlQuery keep adding error listener, which causes memory leak. Also it is not necessary since the error catched in the promise .catch(..). --- server/util-server.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/util-server.js b/server/util-server.js index deacb3a9..ec68c2f3 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -238,10 +238,6 @@ exports.dnsResolve = function (hostname, resolverServer, resolverPort, rrtype) { */ exports.mssqlQuery = function (connectionString, query) { return new Promise((resolve, reject) => { - mssql.on("error", err => { - reject(err); - }); - mssql.connect(connectionString).then(pool => { return pool.request() .query(query);