Question for Autoscale

Question:
Does the Autoscale servers restart automatically? I’ve made a feature in my app to automatically clear after 24 hours, and it looks like it’s not working.

Hi @TheBestDeveloper !
Could you elaboare further on this problem, like what is it that it’s clearing, and what is not working?
Autoscale turns on per request. Maybe you might want to take a look at Scheduled Deployments?

Basically, I have a chat app, for my class.

I bascically did this code:

stored_messages = []

def clear_messages_task():
  while True:
      global stored_messages  # Use global to modify the stored_messages variable
      time.sleep(86400)  # Wait for 24 hours (86400 seconds)
      stored_messages = []  # Clear the list of stored_messages
      print("Stored messages cleared for privacy.")

And I waited 24 hours, but it does not clear. Is there any way to fix this?

So the reason could be this:
You visited the page, then closed it and came back 24 hours later. As Autoscale turns on on request, it will need to wait 24 hours with the site open to clear it.
Instead, I suggest Reserved VM Deployments, as it continually runs with 99.99% uptime. If you have a webserver, choose the Web server option when deploying.

Hope this helps!

In addition, autoscale deployments shut down after each request regardless, which is why websockets don’t work.

4 Likes

how to go through that, so they dont shut down

You can’t stop an autoscale from turning off automatically, you’ll have to use a reserved VM if you need that.

2 Likes

im trying to understand on how to make the autoscale 24/7 , would that be by having the code to send requests repeatedly

No, the code cannot keep itself alive. Even still, autoscale will shut down as soon as it’s done handling a request. Autoscale is not intended to run 24/7, it’s intended to be on-demand.

2 Likes

isnt on demand meaning when it detects a request??

Yes, but it will still shut back down in the miliseconds between requests. Either way, it cannot ping itself, that does not work.

how do u know all this is there a documentation for autoscale lol

It’s been said by staff on the forums here before, and there are docs here.

  • It can not perform background activities outside of request handling.

So it’s not allowed to do data storage, nor ping itself.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.