laser_sex_machine
laser_sex_machine

Reputation: 79

Why heroku kills my process with status 143?

I've small app(git) on node on Heroku that works with api for vk.com(social network), but Heroku kills it with SIGTERM after 30 min. I use setInterval which sends request to vk.com server and processes the response once every 20 min:

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);

How to fix this problem, or maybe you know another free hosting where can deploy an app like this? ERRORLOG: errorlog

Upvotes: 1

Views: 8254

Answers (2)

laser_sex_machine
laser_sex_machine

Reputation: 79

Just add something like this in your code:

var reqTimer = setTimeout(function wakeUp() {
   request("https://nameless-gorge-19527.herokuapp.com", function() {
      console.log("WAKE UP DYNO");
   });
   return reqTimer = setTimeout(wakeUp, 1200000);
}, 1200000);

Upvotes: 2

Tuan Anh Tran
Tuan Anh Tran

Reputation: 7267

Free dynos are unique because they go to sleep after 30 minutes of inactivity.

From Heroku devcenter

Are you using free dynos by any chance?

If you're looking for a free service, maybe give aws lambda a try? They give you 1M free call per month i think, IIRC

Upvotes: 3

Related Questions