schedule icon indicating copy to clipboard operation
schedule copied to clipboard

Schedule only runs once?

Open RWRmrfrog opened this issue 1 year ago • 2 comments

I have a feeling it's because I'm using multithreading, though I'm only using one schedule event. I don't really know what I'm doing wrong, but the event only runs once and then stops (instead of every three minutes or every day). I'm on windows 11 if that makes any difference. Putting the schedule code in another function doesn't help either.

###functions up here###

if __name__ == "__main__":
    startThread = Thread(target=start).start()
    userThread = Thread(target=userInput).start()
    
    schedule.every(3).minutes.do(backup)
    #schedule.every().day.at(backup_time).do(backup)
    while True:
        schedule.run_pending()
        time.sleep(10)

RWRmrfrog avatar Mar 23 '24 16:03 RWRmrfrog

I'm having the same issue. My job function uses the AWS Boto3 SDK, which, I think, uses threading/coroutine—maybe that is the issue. In the older version without calling boto3, the scheduler worked fine.

I'm also on Windows 11. Python 3.11.5

empve avatar Apr 14 '24 10:04 empve

I can work around it by invoking the part interacting with AWS boto3 in a subprocess. But it makes the code significantly convoluted. I'm pretty sure it's a common use case among the users, so please investigate.

Thanks

empve avatar Apr 14 '24 23:04 empve