Search code examples
herokuserverpingdyno

Is pinging Heroku to keep free dynos from shutting off illegal/against the TOS?


I've verified my account on Heroku so I have my 1000 free Dynos hours and only one project, and I'm only using the basic dynos. With that in mind, I thought it would be good to ping the server once every 30 minutes to make it so the dynos don't sleep and they can run continuously. Is that illegal? It seems like such a common situation and Heroku wouldn't make money from it so I feel like I must be missing something...thanks for any/all help! Oh, and if you have some easy implementations for pinging as well, I'd love to hear of them/see them.


Solution

  • It is perfectly fine to do that as you are entitled to you use 1000hrs as part of the Free plan.

    One option to keep the Heroku app alive is to initiate a ping when the users access a web page (assuming here there is a web site or web app as frontend, for example a web page on GitHub)

    <script language="javascript">
    function wakeUpCall() {
      var xhr2 = new XMLHttpRequest();  
      xhr2.open("GET", "https://myapp.herokuapp.com/", true);
      xhr2.send(null);
    }
    
    Alternatively you could look at Cloud Scheduler service (ie Google Scheduler) and of course something running on your machine if this is always on.