<small id='JUcd2'></small><noframes id='JUcd2'>

<tfoot id='JUcd2'></tfoot>

        <bdo id='JUcd2'></bdo><ul id='JUcd2'></ul>
      <legend id='JUcd2'><style id='JUcd2'><dir id='JUcd2'><q id='JUcd2'></q></dir></style></legend>

        <i id='JUcd2'><tr id='JUcd2'><dt id='JUcd2'><q id='JUcd2'><span id='JUcd2'><b id='JUcd2'><form id='JUcd2'><ins id='JUcd2'></ins><ul id='JUcd2'></ul><sub id='JUcd2'></sub></form><legend id='JUcd2'></legend><bdo id='JUcd2'><pre id='JUcd2'><center id='JUcd2'></center></pre></bdo></b><th id='JUcd2'></th></span></q></dt></tr></i><div id='JUcd2'><tfoot id='JUcd2'></tfoot><dl id='JUcd2'><fieldset id='JUcd2'></fieldset></dl></div>

        成功执行后,我的 nodejs 脚本没有自行退出

        时间:2024-04-15
      1. <legend id='kd8DC'><style id='kd8DC'><dir id='kd8DC'><q id='kd8DC'></q></dir></style></legend>
            <tbody id='kd8DC'></tbody>

            <i id='kd8DC'><tr id='kd8DC'><dt id='kd8DC'><q id='kd8DC'><span id='kd8DC'><b id='kd8DC'><form id='kd8DC'><ins id='kd8DC'></ins><ul id='kd8DC'></ul><sub id='kd8DC'></sub></form><legend id='kd8DC'></legend><bdo id='kd8DC'><pre id='kd8DC'><center id='kd8DC'></center></pre></bdo></b><th id='kd8DC'></th></span></q></dt></tr></i><div id='kd8DC'><tfoot id='kd8DC'></tfoot><dl id='kd8DC'><fieldset id='kd8DC'></fieldset></dl></div>

            <tfoot id='kd8DC'></tfoot>

              <small id='kd8DC'></small><noframes id='kd8DC'>

                • <bdo id='kd8DC'></bdo><ul id='kd8DC'></ul>

                  本文介绍了成功执行后,我的 nodejs 脚本没有自行退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我编写了一个脚本来在从 db 表和 solr 读取数据后更新我的 db 表.我正在使用 asyn.waterfall 模块.问题是在成功完成所有操作后脚本没有退出.我使用过 db 连接池也认为可能正在创建脚本以无限等待.我想将此脚本放在 crontab 中,如果它不能正确退出,则会不必要地创建大量实例.

                  I have written a script to update my db table after reading data from db tables and solr. I am using asyn.waterfall module. The problem is that the script is not getting exited after successful completion of all operations. I have used db connection pool also thinking that may be creating the script to wait infinitly. I want to put this script in crontab and if it will not exit properly it would be creating a hell lot of instances unnecessarily.

                  推荐答案

                  我刚刚解决了这个问题.

                  I just went through this issue.

                  仅使用 process.exit() 的问题在于我正在处理的程序正在创建句柄,但从未销毁它们.

                  The problem with just using process.exit() is that the program I am working on was creating handles, but never destroying them.

                  它正在处理一个目录并将数据放入orientdb.

                  It was processing a directory and putting data into orientdb.

                  所以我学到的一些东西是在摆脱引用之前需要关闭数据库连接.而 process.exit() 并不能解决所有情况.

                  so some of the things that I have come to learn is that database connections need to be closed before getting rid of the reference. And that process.exit() does not solve all cases.

                  当我的项目处理 2,000 个文件时.它会减少到大约 500 个,额外的句柄会填满可用的工作内存.这意味着它将无法继续.因此永远不会到达 process.exit 最后.

                  When my project processed 2,000 files. It would get down to about 500 left, and the extra handles would have filled up the available working memory. Which means it would not be able to continue. Therefore never reaching the process.exit at the end.

                  另一方面,如果您关闭请求应用保持打开状态的项目,则可以从源头上解决问题.

                  On the other hand, if you close the items that are requesting the app to stay open, you can solve the problem at its source.

                  我能够使用的两个未记录的函数"是

                  The two "Undocumented Functions" that I was able to use, were

                  process._getActiveHandles();
                  process._getActiveRequests();
                  

                  我不确定还有哪些其他功能可以帮助调试这些类型的问题,但这些功能非常棒.

                  I am not sure what other functions will help with debugging these types of issues, but these ones were amazing.

                  它们返回一个数组,您可以通过使用这些方法确定很多关于您的过程中发生的事情.

                  They return an array, and you can determine a lot about what is going on in your process by using these methods.

                  我只是希望能帮助其他在这篇文章中绊倒的人.

                  I just hope that helps anyone else stumbling across this post.

                  这篇关于成功执行后,我的 nodejs 脚本没有自行退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 mysql 连接到 postgresql 下一篇:使用 Solr 数据导入处理程序将多值字段从 mySQL 导入 Solr

                  相关文章

                    <small id='xUwVN'></small><noframes id='xUwVN'>

                    <legend id='xUwVN'><style id='xUwVN'><dir id='xUwVN'><q id='xUwVN'></q></dir></style></legend>

                  1. <tfoot id='xUwVN'></tfoot>
                        <bdo id='xUwVN'></bdo><ul id='xUwVN'></ul>
                      <i id='xUwVN'><tr id='xUwVN'><dt id='xUwVN'><q id='xUwVN'><span id='xUwVN'><b id='xUwVN'><form id='xUwVN'><ins id='xUwVN'></ins><ul id='xUwVN'></ul><sub id='xUwVN'></sub></form><legend id='xUwVN'></legend><bdo id='xUwVN'><pre id='xUwVN'><center id='xUwVN'></center></pre></bdo></b><th id='xUwVN'></th></span></q></dt></tr></i><div id='xUwVN'><tfoot id='xUwVN'></tfoot><dl id='xUwVN'><fieldset id='xUwVN'></fieldset></dl></div>