AndreasMadsen / trace

Creates super long stack traces
https://trace.js.org
MIT License
194 stars 18 forks source link

`executionScopeDepth` does not make sense if concurrent async operations #46

Closed cspotcode closed 5 years ago

cspotcode commented 5 years ago

As far as I can tell, executionScopeDepth doesn't really make sense if multiple async operations are happening at once. Rather than being a "depth," it sounds like it represents the total # of active async contexts, right? In an active server, it may never reach 0. Is my interpretation correct?

AndreasMadsen commented 5 years ago

it sounds like it represents the total # of active async contexts

Only in the current turn (partial tick) of the process.

In an active server, it may never reach 0. Is my interpretation correct?

It most definitely will each 0. Again, the depth is only in terms of layered execution of emitBefore. An example is setTimeout. In most cases executionScopeDepth will either be 1 or 0.