From 6c62c85680388644807df0daab1f5434332b93eb Mon Sep 17 00:00:00 2001 From: Rohland de Charmoy Date: Mon, 6 Nov 2023 07:33:35 +0200 Subject: [PATCH] :bug: fixing issue when disconnecting from mysql --- package.json | 2 +- src/evaluators/mysql.ts | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 40f1c8f..f32ad25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "barky", - "version": "1.0.47", + "version": "1.0.48", "description": "A simple cloud services watchdog with digest notification support & no external dependencies", "homepage": "https://github.com/Rohland/barky#readme", "main": "dist/cli.js", diff --git a/src/evaluators/mysql.ts b/src/evaluators/mysql.ts index df8b2c1..94be077 100644 --- a/src/evaluators/mysql.ts +++ b/src/evaluators/mysql.ts @@ -38,7 +38,7 @@ export class MySqlEvaluator extends BaseEvaluator { apps }; } finally { - disposeConnections(); + await disposeConnections(); } } @@ -193,14 +193,8 @@ export async function getConnection(app): Promise { return connection; } -export function disposeConnections() { - connections.forEach(x => { - try { - x.destroy(); - } catch { - // no-op - } - }); +export async function disposeConnections() { + await Promise.allSettled(connections.map(x => x.end())); connections = []; }