Forums

Always on tast and sleep time

Hello, If I use an always on task but put sleep times on it to do it periodically. And night time every 10 min, daytime every 3 min. So I would like to put time.sleep() in it. The question is How much CPU time will it use? It will a lot or not a big deal? Thank you in advance!

It's the question what is the rest of your code doing. You can observe your CPU usage in time using our CPU API. see https://blog.pythonanywhere.com/181/

Thank you! I rewrite the question, the rest of the code I don't care. So I mean if I put an always on task with 10 or 15 min time.sleep() is it takes a lot of resource about CPU? Or not a big deal do this and do 4 or 6 tasks which starts every hours separated minutes. So I don't know the CPU time of time.sleep(). If the prevoius 2 is almost the same, for me the always on is better. (For example the error handling) Thank you in advance!

Sleep is not draining your cpu seconds.

Thanks! :D