0

在 node.js 中,我使用 oriento 模块来访问 OrientDB。原则上一切正常,唯一的事情是程序没有按应有的方式退出。这是示例:

const oriento = require("oriento");
const server = oriento({});
const db = server.use(dbname);
db.select("@rid").from("codelists").limit(1).scalar().then(function (result) {
    console.dir(result);
}).finally(function () {
    db.close();
    server.close();
    console.info("finished");
});

程序执行 select,然后是“then”,最后是“finally”子句。一切都好。但它不会退出。事件循环上似乎有一些东西。但是什么?我怎样才能摆脱它?问题实际上比“按 Ctrl-C”或在一切完成后使用 process.exit() 更糟糕,因为代码应该在单元测试中运行,而我无法调用 exit。有什么建议么?

4

2 回答 2

1

该问题在当前的 oriento 主版本中得到了解决。https://github.com/codemix/oriento/issues/170

于 2014-12-20T19:41:33.463 回答
0

您可以使用process._getActiveRequests()process._getActiveHandles()查看保持应用程序打开的原因。它们没有记录,但通常用于这种情况。

于 2014-12-18T22:48:19.253 回答