Skip to content

Instantly share code, notes, and snippets.

@mridgway
Created August 26, 2014 03:17
Show Gist options
  • Select an option

  • Save mridgway/5c79169a827892fec6bb to your computer and use it in GitHub Desktop.

Select an option

Save mridgway/5c79169a827892fec6bb to your computer and use it in GitHub Desktop.

Revisions

  1. mridgway created this gist Aug 26, 2014.
    22 changes: 22 additions & 0 deletions td-api.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    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());
    }