mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
[fix] Make closePool async; Bump nodejs version for mysql test; For bug 68194
This commit is contained in:
2
.github/workflows/mysqlDatabaseTests.yml
vendored
2
.github/workflows/mysqlDatabaseTests.yml
vendored
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user