dbader / schedule

Python job scheduling for humans.
https://schedule.readthedocs.io/
MIT License
11.73k stars 959 forks source link

Using Schedule with a webserver in the same script #498

Closed drixie closed 2 years ago

drixie commented 2 years ago

I have noticed Schedule does not work when it is in the same script with a webserver (e.g. main.py). I have tried both FastAPI and Eventlet with no success.

I will appreciate any pointers on how to get this to work.

SijmenHuizenga commented 2 years ago

In most schedule examples, schedule runs on the main thread. I'm guessing that the webserver uses the main thread as well. You probably need to run schedule on a background thread, like described here.