Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
fix(mysql): fixing callback wrapping in some case, adding debug line (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ron Yishai authored and ranrib committed Feb 17, 2019
1 parent 84b06cc commit 1be691f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/events/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ function mysqlQueryWrapper(wrappedFunction) {
this.config,
'mysql'
);
if (typeof sql === 'string') {
callback = patchedCallback;
} else {
if (sql.onResult) {
sql.onResult = patchedCallback; // eslint-disable-line
} else {
callback = patchedCallback;
}
return wrappedFunction.apply(this, [sql, params, callback]);
};
Expand Down
1 change: 1 addition & 0 deletions src/events/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module.exports.wrapSqlQuery = function wrapSqlQuery(queryString, params, callbac

const responsePromise = new Promise((resolve) => {
patchedCallback = (err, res, fields) => {
utils.debugLog('SQL Patched callback was called.');
dbapiEvent.setDuration(utils.createDurationTimestamp(startTime));

if (err) {
Expand Down

0 comments on commit 1be691f

Please sign in to comment.