Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

node-blocked

> 编程语言
Open source

Check if the event loop is blocked

733 stars0 likes3 views
WebsiteGitHub

About

Check if the event loop is blocked

blocked

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.

Installation

$ npm install blocked

Description

The 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.

Params and return value

javascript
var timer = blocked(fn, options);
  • fn: The callback function to execute when the event loop is blocked. Will send in the amount of time in ms that the event loop was blocked.
  • options: Optional. Options object to configure the behaviour.
    • 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.
javascript
blocked(function(ms) {
    console.log("Blocked");
}, {threshold:1, interval: 1000});

Returns: A reference to the timer. Useful for clearing the timer.

javascript
var timer = blocked(function(ms) {
                console.log("Blocked");
            });
clearInterval(timer);

License

MIT

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言