The keep_alive function isnt working

I’m a discord bot developer. and from today I’m seeing that the keep_alive function isnt working so that i can make the bot online 24/7

Same with me from today morning

Hi @zerxOP,

  • Basically, Replit force shuts down Repls to save resources. Think about it, if you had your computer running a program forever, never stopping, running with essentially infinite resources, even when it’s not doing anything. That’s basically most Repls. Which is why Replit will shut down Repls after x amount of inactivity.
  • After finishing the main thread in your program, the code will set itself to being done but if another thread is running, this thread will continue after. However, if the entire Repl gets shut down, then all threads are closed so basically running another thread is a cheap party trick for the UI.

Basically, you can’t run the pinger in your Repl, so try running an external pinger. This will work for the very current ecosystem but Replit is migrating to new systems so I can’t say this will work for much longer.

3 Likes

If you’re using python the same thing happened for me a lot but I use uptimerobot.com to ping my nodejs repl and the bot has been online for like 7 months so if you’re using python try using nodejs

it’s fixed now
if you change the server to US the problem doesn’t occur