Forums

Always on task

Hi

I've got an always on task running. It does some stuff, including putting a timestamp into a MySQL table to show when an update was done.

All the functions are in a while True: and then there's a time.sleep (60) at the end. So it should be running every minute as far as I can see.

However, when I checked the MySQL earlier, the timestamp was getting updated about every 30 seconds - give or take a second for the script to run.

I killed everything, deleted the task and recreated it. It seems to be running every minute now. I need to be a bit careful as it runs an API call so once a minute is the maximum. Is there a reason why it went to every 30 seconds?

Cheers Andy

That's a bit strange. I can't think of any way that that could happen, unless at some point you had a 30s wait and then changed the code, without stopping and starting the task, so it just continued with the 30s wait.

Nope. It's a fairly new bit of code and it's been 60s from the start. Never mind, it seems to be fine now :)

Very odd indeed! I can't think of any way this could have happened, but perhaps there were two copies running somehow?