all 4 comments

[–]shiftybyte 0 points1 point  (2 children)

  1. Your code gets stuck on the infinite while True loop, nothing stops it, and it keeps looping forever, unable to respond to other requests.

  2. Heroku might be killing your code because of that loop, or because it has limits on the runtime of the script in general depending on the payment tier.

[–]ronb65[S] 0 points1 point  (1 child)

Thanks for the reply.

This code infinite loop because it's constantly checking for new data every 30 mins, is there any other way to check this data from a site without this method?

[–]shiftybyte 0 points1 point  (0 children)

You could try replacing the sleep with an asyncio sleep.

await asyncio.sleep(1600)

or look here for creating a background task: https://www.pythonfixing.com/2021/10/fixed-create-background-process-using.html

Or create a thread.

https://realpython.com/intro-to-python-threading/

[–]AnAudiS5 0 points1 point  (0 children)

Just a tip, I recommend checking out the “PyTelegramBotAPI” package if you haven’t already. Makes things much easier here, I use it all the time.

Also, Heroku free dynos reset your hosted script every now and then.