mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 14:38:50 +00:00
refactor(execute): await connection to send query
Waiting for the connection to become available lets us move executiontime back into the resource.
This commit is contained in:
1 parent
e685ff5f4c
commit
a352273b08
2 files changed
+16
-8
No files matched your search
+2
-2
@@ -13,7 +13,7 @@ const transaction = async (queries, parameters, resource) => {
|
||||
ScheduleResourceTick(resourceName);
|
||||
const connection = await pool.getConnection();
|
||||
try {
|
||||
const time = debug ? process.hrtime.bigint() : Date.now();
|
||||
const startTime = process.hrtime(startTime);
|
||||
|
||||
const fullQuery = parseTransaction(queries, parameters);
|
||||
const transactionAmount = fullQuery.length;
|
||||
@@ -26,7 +26,7 @@ const transaction = async (queries, parameters, resource) => {
|
||||
|
||||
await connection.commit();
|
||||
|
||||
const executionTime = debug ? Number(process.hrtime.bigint() - time) / 1e6 : Date.now() - time;
|
||||
const executionTime = process.hrtime(startTime)[1] / 1000000;
|
||||
|
||||
if (executionTime >= slowQueryWarning * transactionAmount || debug)
|
||||
console.log(
|
||||
|
||||
Reference in new issue
Block a user