Skip to content

Instantly share code, notes, and snippets.

@mridgway
Created August 26, 2014 03:17
Show Gist options
  • Save mridgway/5c79169a827892fec6bb to your computer and use it in GitHub Desktop.
Save mridgway/5c79169a827892fec6bb to your computer and use it in GitHub Desktop.
diff --git a/lib/route.js b/lib/route.js
index 673bc7c..86835f1 100644
--- a/lib/route.js
+++ b/lib/route.js
@@ -183,7 +183,8 @@ function getResourceRoute(stores) {
function postRoute(stores) {
return function (req, res) {
- var api_requests = {},
+ var timer = req.perf.start(req.id || 'td-api', 'xhr_lifetime'),
+ api_requests = {},
requests = req.body.requests;
Object.keys(requests).forEach(function (id) {
@@ -238,6 +239,7 @@ function postRoute(stores) {
async.parallel(api_requests, function (err, results) {
res.set(response_defaults);
res.json(200, results);
+ timer.stop();
if (req.query.perf) {
console.log(req.perf.output());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment