Long running job in APScheduler along with FastAPI

Viewed 1058

I have a FastAPI service that exposes some rest APIs and uses gunicorn as the server.

I also have a long-running APScheduler job that needs to run constantly. If I run the scheduler job from within the init_app.py which is started by a gunicorn worker thread, I get the below error and the worker is rebooted:

[CRITICAL] WORKER TIMEOUT (pid:4994)
Booting worker with PID: 4994

My question is what is the best way to start an AP Scheduler along with FastAPI rest endpoints?

0 Answers
Related