BackgroundScheduler in python is running two instances instead of 1
See original GitHub issue0
I am using the background scheduler in python to run one job which does the anlaysis and then update the database . Below is the code for the same : So expected behavior is it will run one thread and wait for 15 seconds then run for the second instance. But this is running two instances together and then taking the break the of 59 second. Below is the output of the job I am running with timestamp
`scheduler.add_job(func=print_date_time, trigger=“interval”,seconds=59)
scheduler.start()
print(scheduler.get_jobs())` ``
`job started at 02:54:11
in the beginning tweetid : blank new tid is : 1090278987920740353 tid not in the database job finished
job started at 02:54:13 in the beginning tweetid : blank new tid is : 1090278987920740353 tid not in the database job finished
job started 02:55:10 in the beginning tweetid : blank new tid is : 1090278987920740353 tid not in the database job finished
job started 02:55:12 in the beginning tweetid : blank new tid is : 1090278987920740353 tid not in the database job finished `************************************************************************************************************************************* I am trying to implement this flask app of python. This is causing inserting the key in the database twice and I am getting the duplicate entry error.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top GitHub Comments
Are you sure you don’t have two workers running the app? There is a FAQ entry about running APScheduler in web apps. Have you read it?
Thank you very much for solution