Skip to content

Commit 92a2d84

Browse files
author
Danilo Resende
committed
Cache req.miniprofiler into a local
With the addition of `async_hooks` [0] the `req.miniprofiler` is now a getter, and some Redis methods don't plays nice with it. [0]: MiniProfiler/node#7
1 parent 44e23a5 commit 92a2d84

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ module.exports = function(redis) {
1616
if (callback && req && req.miniprofiler) {
1717
const query = `${cmd.command} ${cmd.args.join(', ')}`.trim();
1818
const timing = req.miniprofiler.startTimeQuery('redis', query);
19+
const miniprofiler = req.miniprofiler;
20+
1921
cmd.callback = function() {
20-
req.miniprofiler.stopTimeQuery(timing);
22+
miniprofiler.stopTimeQuery(timing);
2123
callback.apply(this, arguments);
2224
};
2325
}

0 commit comments

Comments
 (0)