如何获取Node工作队列中的回调列表? (或者,为什么节点不退出?) [英] How can I get a list of callbacks in the Node work queue? (or, Why won't Node exit?)

查看:49
本文介绍了如何获取Node工作队列中的回调列表? (或者,为什么节点不退出?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它在关于页面的Node.js上显示:

当没有更多的回调要执行时,Node退出事件循环.

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

是否有办法找出哪些回调阻止Node退出?

Is there a way to find out which callbacks are keeping Node from exiting?

推荐答案

您可以使用process._getActiveHandles()process._getActiveRequests()

请参阅node.js邮件列表中的此讨论.

See this discussion in node.js mailing list.

更新:为此,有一个很好的软件包- https ://github.com/mafintosh/why-is-node-running

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

这篇关于如何获取Node工作队列中的回调列表? (或者,为什么节点不退出?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆