amisadmin/fastapi-scheduler

Hello, may I ask why two identical tasks are generated?

china-zhoujie opened this issue · 2 comments

Hello, may I ask why two identical tasks are generated?
2022-11-13 11:22:22,464 - uvicorn.error - INFO - Started reloader process [27370] using statreload
2022-11-13 11:22:24,330 - apscheduler.scheduler - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts
2022-11-13 11:22:24,348 - apscheduler.scheduler - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts
INFO: Started server process [27377]
2022-11-13 11:22:24,349 - uvicorn.error - INFO - Started server process [27377]
INFO: Waiting for application startup.
2022-11-13 11:22:24,350 - uvicorn.error - INFO - Waiting for application startup.
2022-11-13 11:22:24,419 - apscheduler.scheduler - INFO - Added job "cron_task_test" to job store "default"
2022-11-13 11:22:24,419 - apscheduler.scheduler - INFO - Added job "cron_task_test" to job store "default"
2022-11-13 11:22:24,419 - apscheduler.scheduler - INFO - Scheduler started

I think is only duplicated info and didnt create the task.
You could check the jobs are running and see if really is running two identical task.

here why:

Important

If you schedule jobs in a persistent job store during your application’s initialization, you MUST define an explicit ID for the job and use replace_existing=True or you will get a new copy of the job every time your application restarts!