【发布时间】:2018-09-19 22:55:43
【问题描述】:
是的,我可以使用我的 mocha 测试运行 process.exit() 或 --exit,但这似乎是错误的。
我正在维护的一些代码中有 firebase-admin,我正在尝试运行 mocha 测试,但根据 wtfnode:
wtfnode node_modules/.bin/_mocha --compilers coffee:coffee-script/register
Firebase 负责保持我的流程处于打开状态:
- Timers:
- (3300000 ~ 55 min) (anonymous) @ /home/wayne/programming/universe/library/server/node_modu
les/firebase-admin/lib/firebase-app.js:147
- Intervals:
- (45000 ~ 45 s) (anonymous) @ /home/wayne/programming/universe/library/server/node_modules/
firebase-admin/lib/database/database.js:199
非常感谢,Firebase。这令人沮丧。我可以修复数据库部分:
db = app.database();
db.goOffline();
轰隆隆。完毕。现在我只看到不会死的计时器。我该如何杀死它?我试过查看那个源代码,它把我指向了这个小地方:
FirebaseAppInternals.prototype.setTokenRefreshTimeout = function (delayInMilliseconds, numRetries) {
var _this = this;
this.tokenRefreshTimeout_ = setTimeout(function () {
_this.getToken(/* forceRefresh */ true)
.catch(function (error) {
// Ignore the error since this might just be an intermittent failure. If we really cannot
// refresh the token, an error will be logged once the existing token expires and we try
// to fetch a fresh one.
if (numRetries > 0) {
_this.setTokenRefreshTimeout(60 * 1000, numRetries - 1);
}
});
}, delayInMilliseconds);
};
不幸的是,我不知道如何获得tokenRefreshTimeout_,所以我可以cancelTimer。
有没有办法告诉 firebase-admin 我已经完成了,它现在真的需要停止,还是我坚持使用 --exit?
【问题讨论】:
标签: javascript node.js firebase firebase-admin