How can I get a list of callbacks in the Node work queue? (or, Why won't Node exit?)

后端 未结 2 1602
予麋鹿
予麋鹿 2020-11-29 18:32

It says on the Node.js about page:

Node exits the event loop when there are no more callbacks to perform.

Is there a way to find

2条回答
  •  渐次进展
    2020-11-29 18:47

    You can use process._getActiveHandles() and process._getActiveRequests()

    See this discussion in node.js mailing list.

    update: there is a good package for this - https://github.com/mafintosh/why-is-node-running

提交回复
热议问题