Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
fix(plugins/db): close mssql connection pool on app close
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed May 27, 2023
1 parent 8ba9f10 commit 37ee5a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 37ee5a7

Please sign in to comment.