1

I'm using apschedular lib to run the cron job every 5 min.So that it will send the push notifications(It is sending twice)

job_defaults = {
    'coalesce': True,  # The accumulated task will only run once
    'max_instances': 1000
}

schedule = BackgroundScheduler(job_defaults=job_defaults)


@app.before_first_request
@schedule.scheduled_job('interval', minutes=5)
def timed_job():
    with app.app_context():
        time = datetime.now().replace(microsecond=0)
        print("calling create {0}".format(time))
        schedule_notifications.create()

I have tried this solution apscheduler in Flask executes twice

But still it is calling twice I have updates this in flask app also

app.run(use_reloader=False)

I hope master and child class are calling , is there a way to stop this

shaik
  • 11
  • 1
  • 2

0 Answers0