package
check if the event loop is blocked
npm install blockedGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
3.6 kB
Includes dependencies.
Check if a node event loop is blocked.
If You're running Node.js 8+ you can get a stacktrace pointing to the blocking function using very similar blocked-at package.
$ npm install blockedThe blocked() function reports every value over the configured threshold (defaulted to 10ms). You can then do whatever
you want with that value, graph it, log it, alert, etc.
The process won't be kept open through this.
var timer = blocked(fn, options);threshold determines the amount of ms used to determine if the function callback should be executed; useful to speed up tests.interval determines the frequency with which the event loop is checked in ms.blocked(function(ms) {
console.log("Blocked");
}, {threshold:1, interval: 1000});Returns: A reference to the timer. Useful for clearing the timer.
var timer = blocked(function(ms) {
console.log("Blocked");
});
clearInterval(timer);MIT
juliangruber
julian@juliangruber.com