Bugs when using setinterval function


#1

I have a discord bot that runs 24x7 with the help of the http visit code copied from anidiotsguide. By using this my own bot will visit my webpage to keep the bot itself active for whole day
But the problem is by using this my bot visits my webpage for every 15 mins. That means my bot gets restarted every 15 min.

The problem is when I use setinterval with the delay of 1 hour it wont work because my bot gets restarted at 15 minutes
Is there any solution for this???


#2

We don’t recommend using setInterval to keep a project awake. Projects awake for 12 hours are forced to sleep and when using setInterval it won’t wake again. Instead it’s better to expose a route and hit that end-point every 5 minutes with a web cron service like uptimerobot.