[fix] Make closePool async; Bump nodejs version for mysql test; For bug 68194

This commit is contained in:
Sergey Konovalov
2024-06-03 13:07:33 +03:00
parent 8d401629c5
commit d779c08027
2 changed files with 4 additions and 8 deletions

View File

@ -21,7 +21,7 @@ jobs:
- name: Caching dependencies
uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '16'
cache: 'npm'
cache-dependency-path: |
./npm-shrinkwrap.json

View File

@ -54,7 +54,7 @@ const connectionConfiguration = {
const additionalOptions = configSql.get('mysqlExtraOptions');
const configuration = Object.assign({}, connectionConfiguration, additionalOptions);
let pool = null;
let pool = mysql.createPool(configuration);
function sqlQuery(ctx, sqlCommand, callbackFunction, opt_noModifyRes = false, opt_noLog = false, opt_values = []) {
return executeQuery(ctx, sqlCommand, opt_values, opt_noModifyRes, opt_noLog).then(
@ -66,10 +66,6 @@ function sqlQuery(ctx, sqlCommand, callbackFunction, opt_noModifyRes = false, op
async function executeQuery(ctx, sqlCommand, values = [], noModifyRes = false, noLog = false) {
let connection = null;
try {
if (!pool) {
pool = mysql.createPool(configuration);
}
connection = await pool.getConnection();
const result = await connection.query(sqlCommand, values);
@ -102,8 +98,8 @@ async function executeQuery(ctx, sqlCommand, values = [], noModifyRes = false, n
}
}
function closePool() {
return pool?.end();
async function closePool() {
return await pool.end();
}
function addSqlParameter(parameter, accumulatedArray) {