How to restart the Meteor server from Meteor.js

The project I did with Meteor has a memory leak that slowly builds up over a month or two. After plunging days looking for leaks, I throw a towel in favor of just adding an automatic restart that happens once a month. Yes, this is bad practice, etc.

Is there a way to just restart the server codebase from the inside? Ideally, this will also trigger an update for connected clients (similar to regular deployment updates).

Then I assume that this command could just be nested in the good old JS timeout function.

+6
source share
1 answer

The answer from apendua worked. This is a common hack and is not recommended in most cases, but is great for long-term memory leaks.

Put this in your script run:

var restartFrequency = 1000 * 60 * 24; // 1 day (1000 millsec * 60 min * 24 hour) setTimeout(function(){ process.exit(); }, restartFrequency); 
+3
source

Source: https://habr.com/ru/post/975634/


All Articles