fix(execute): incorrect execution time for multiple queries

When sending bulk-statements using prepare, the execution time
would always be calculated based on the start of the first query.

This would mistakenly report successive queries as taking longer,
and possibly report slow queries (i.e. when saving all players).
This commit is contained in:
Linden committed 2022-03-27 08:32:39 +11:00
1 parent 9fec9cccba
commit f82fa72643
1 file changed
+1 -1
+1 -1
View File
@@ -24,11 +24,11 @@ export const rawExecute = async (
try {
const placeholders = query.split('?').length - 1;
const results = [] as RowDataPacket;
const executionTime = process.hrtime();
if (type !== null) await connection.beginTransaction();
for (let values of parameters as CFXParameters[]) {
const executionTime = process.hrtime();
values = parseValues(placeholders, values);
const [rows] = (await connection.execute(query, values)) as RowDataPacket[][];