This commit is contained in:
4
main.py
4
main.py
@ -74,14 +74,14 @@ async def lifespan(app: FastAPI):
|
||||
if scheduler.running:
|
||||
logger.warning("Scheduler already running. Skip start.")
|
||||
else:
|
||||
_add_jobs()
|
||||
|
||||
try:
|
||||
scheduler.start()
|
||||
logger.info("APScheduler started.")
|
||||
except Exception:
|
||||
logger.exception("Failed to start APScheduler:")
|
||||
raise
|
||||
|
||||
_add_jobs()
|
||||
|
||||
yield # ---- 应用运行中 ----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user