From 37ee5a7b6941d6d6c467968d29415ba96194272b Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sat, 27 May 2023 11:34:12 +0100 Subject: [PATCH] fix(plugins/db): close mssql connection pool on app close --- src/plugins/db/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/db/index.js b/src/plugins/db/index.js index fae4d6d3..2faf25e2 100644 --- a/src/plugins/db/index.js +++ b/src/plugins/db/index.js @@ -42,13 +42,13 @@ async function plugin(server, options) { case "mssql": default: server.log.info("Connecting to MSSQL DB"); - await mssql.connect(options.connection); + pool = await mssql.connect(options.connection); server.log.info("MSSQL DB connection opened"); server.decorate("db", mssql); server.addHook("onClose", async () => { server.log.info("Closing MSSQL DB connection"); - await mssql.close(); + await pool.close(); server.log.info("MSSQL DB connection closed"); }); break;