| 12345678910111213141516171819202122232425 |
- from app import create_app
- #from apscheduler.schedulers.background import BackgroundScheduler as BS
- #from apscheduler.triggers.cron import CronTrigger
- #from app.dispatch import check_auction_end
- app = create_app()
- if __name__ == '__main__':
- '''
- with app.app_context():
- # Background Scheduler for Background tasks
- #app.app_context().push() # need to wrap this in app context
- sched = BS(daemon=True)
- if not sched.running:
- print(f'DEBUG: STARTING SCHEDULER')
- # pass the function of check_auction_end, don't call
- #sched.add_job(check_auction_end, CronTrigger.from_crontab('0 0 * * *'))
- #sched.add_job(check_auction_end, CronTrigger.from_crontab('*/2 * * * *'))
- sched.add_job(check_auction_end, trigger="interval", seconds=60)
- sched.start()
- '''
- app.run(debug=True)
|