Skip to content

Commit

Permalink
fix string concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Nov 1, 2023
1 parent 0f6cf7e commit 41a4e8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const connect = async (config) => {
const poolKey = getPoolKey(config);
let pool = POOLS.get(poolKey);
if (pool === undefined || !pool.connected) {
debugSQL('New database connection: ' + poolKey);
debugSQL(`New database connection: ${poolKey}`);
pool = await new mssql.ConnectionPool(config).connect();
POOLS.set(poolKey, pool);
}
Expand All @@ -23,16 +23,17 @@ export const connect = async (config) => {
return pool;
};
export const releaseAll = () => {
debugSQL('Releasing ' + POOLS.size.toString() + ' pools.');
debugSQL(`Releasing ${POOLS.size.toString()} pools.`);
for (const poolKey of POOLS.keys()) {
debugSQL('Releasing pool: ' + poolKey);
debugSQL(`Releasing pool: ${poolKey}`);
try {
const pool = POOLS.get(poolKey);
if (pool !== undefined) {
void pool.close();
}
}
catch {
debugSQL('Error closing connections.');
}
}
POOLS.clear();
Expand Down
8 changes: 4 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const connect = async (
let pool = POOLS.get(poolKey)

if (pool === undefined || !pool.connected) {
debugSQL('New database connection: ' + poolKey)
debugSQL(`New database connection: ${poolKey}`)

pool = await new mssql.ConnectionPool(config).connect()
POOLS.set(poolKey, pool)
Expand All @@ -39,18 +39,18 @@ export const connect = async (
}

export const releaseAll = (): void => {
debugSQL('Releasing ' + POOLS.size.toString() + ' pools.')
debugSQL(`Releasing ${POOLS.size.toString()} pools.`)

for (const poolKey of POOLS.keys()) {
debugSQL('Releasing pool: ' + poolKey)
debugSQL(`Releasing pool: ${poolKey}`)

try {
const pool = POOLS.get(poolKey)
if (pool !== undefined) {
void pool.close()
}
} catch {
// ignore
debugSQL('Error closing connections.')
}
}

Expand Down

0 comments on commit 41a4e8f

Please sign in to comment.