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?