Skip to content

Commit

Permalink
fix(pg): use callback when they are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
gergelyke committed Nov 22, 2016
1 parent ce9a5ab commit 2557cca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/instrumentations/pg.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ function wrapClient (pg, agent) {
var url = this.database
var port = this.port
var args = Array.prototype.slice.apply(arguments)
var isCallback = typeof args[args.length - 1] === 'function'

return utils.wrapQuery.call(this, original, args, agent, {
protocol: consts.PROTOCOLS.POSTGRES,
url: url,
host: port ? host + ':' + port : host,
method: utils.tryParseSql(args[0])
method: utils.tryParseSql(args[0]),
disableCallback: !isCallback
})
}
})
Expand Down

0 comments on commit 2557cca

Please sign in to comment.