Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

How to deal with functions that runs in parallel? #27

@goenning

Description

@goenning

Hello,

On Node.js webapps it's very common to have async functions running in parallel, for example, I can send a HTTP request to two endpoints at the same time and when I got the response from both, I render the view.

app.get('/', (req, res) => {
  async.parallel([
    request.bind(this, 'http://jsonip.com'),
    request.bind(this, 'http://jsonip.com') //just suppose it's a different endpoint
  ], function(err, results) {
    res.render('index');
  });
});

MiniProfiler is correctly recording timing for both requests, but the UI is showing the sum of durations.

I want to make a PR for this, but first I'd like to get you opinion on what should be done here.

Using the example above, the correct shown duration should be 429.9ms.

mp3

We can complicate it even more with a scenario like this:
Request 1 - Started at 10ms with duration of 400ms
Request 2 - Started at 200ms with duration of 300ms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions