我在 Heroku 上的 Node 上有一个小应用程序(git),它与 vk.com(社交网络)的 api 一起使用,但 Heroku 在 30 分钟后用 SIGTERM 杀死了它。我使用 setInterval 向 vk.com 服务器发送请求并每 20 分钟处理一次响应:
var timerID = setInterval( function reposting() {
vk.executes("wall.get", [
{owner_id: -97758272, count: 1, extended: true},
{owner_id: -109933725, offset: 1, count:1, extended: true}
])
.then((wall_list) => {
wall_list.forEach(function(wall, index) {
repost_and_join(wall, index);
});
})
.catch((error) => {
console.log("WALL_GET_ERROR: "+error);
});
}, 600000);
最佳答案
Free dynos are unique because they go to sleep after 30 minutes of inactivity.
您是否使用免费测功机?
如果您正在寻找免费服务,可以尝试一下 aws lambda 吗?我想他们每月会给你 100 万次免费通话,IIRC
关于node.js - 为什么 heroku 会终止我的进程,状态为 143?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45667535/