Skip to content

Commit

Permalink
🐛 fixing issue when disconnecting from mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohland committed Nov 6, 2023
1 parent b9d2690 commit 6c62c85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 3 additions & 9 deletions src/evaluators/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class MySqlEvaluator extends BaseEvaluator {
apps
};
} finally {
disposeConnections();
await disposeConnections();
}
}

Expand Down Expand Up @@ -193,14 +193,8 @@ export async function getConnection(app): Promise<mysql.Connection> {
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 = [];
}

0 comments on commit 6c62c85

Please sign in to comment.