A project I've made with Meteor has a memory leak that slowly accumulates over the course of a month or two. After sinking days into finding the leak, I'm throwing in the towel in favor of just adding an auto-restart that happens once a month. Yes this is bad practice, etc.
我用Meteor制作的一个项目有一个内存泄漏,在一两个月内缓慢累积。在寻找泄漏的几天后,我正在放弃,只是添加一个月发生一次的自动重启。是的,这是不好的做法,等等。
Is there a way to simply restart from within the server's codebase? Ideally this will also trigger a refresh for connected clients (similar to regular deployment updates).
有没有办法简单地从服务器的代码库中重新启动?理想情况下,这也会触发连接客户端的刷新(类似于常规部署更新)。
Then I assume this command could just be nested in a good old JS timeout function.
然后我假设这个命令可以嵌套在一个很好的旧JS超时函数中。
1 个解决方案
#1
3
The answer provided by apendua worked. It's a total hack, and not recommended for most cases, but great for long-term memory leaks.
apendua提供的答案奏效了。这是一个完全黑客攻击,并不是大多数情况下推荐的,但对于长期内存泄漏非常有用。
Put this inside your startup script:
把它放在你的启动脚本中:
var restartFrequency = 1000 * 60 * 24; // 1 day (1000 millsec * 60 min * 24 hour)
setTimeout(function(){
process.exit();
}, restartFrequency);
#1
3
The answer provided by apendua worked. It's a total hack, and not recommended for most cases, but great for long-term memory leaks.
apendua提供的答案奏效了。这是一个完全黑客攻击,并不是大多数情况下推荐的,但对于长期内存泄漏非常有用。
Put this inside your startup script:
把它放在你的启动脚本中:
var restartFrequency = 1000 * 60 * 24; // 1 day (1000 millsec * 60 min * 24 hour)
setTimeout(function(){
process.exit();
}, restartFrequency);