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.
Asked
Active
Viewed 169 times
1
-
1Please don't make more work for other people by vandalizing your posts. By posting on Stack Overflow, you've granted a non-revocable right, under a [CC BY-SA license](https://creativecommons.org/licenses/by-sa/4.0) for SO to distribute that content. By SO policy, any vandalism will be reverted. If you want to know more about deleting a post, please read more at [How does deleting work?](https://meta.stackexchange.com/q/5221) – dbc Mar 28 '21 at 20:23
1 Answers
2
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.
Beppe C
- 11,256
- 2
- 19
- 41
-
1I ended up just using kaffeine to ping the server every 30 minutes, thank you though :) – nickcoding Mar 15 '21 at 19:39