Problem Description
surroundings
Ubuntu 20.04 Python 3.8.5 APScheduler 3.8.x/3.9.x uvicorn 0.15.0 - 0.17.6
- In the above environment, the scheduled task of
APScheduler
cannot run -
uvicorn 0.14.0
andAPScheduler
not have this problem - Under
Windows
uvicorn
andAPScheduler
with any version, there is no problem
Solution
Start the timer in the
app
startup
event of ---aedd59f1fb65342fb5f8645fcf5f41a4---@app.on_event("startup") async def start_scheduler(): AsyncSched = AsyncIOScheduler(timezone="Asia/Shanghai") scheduler.add_job(...) scheduler.start()
- See uvicorn can't reload when i use apscheduler and fastapi together
This article is from qbit snap
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。