Force interval jobs to run on startup

This commit is contained in:
Jake Howard 2019-02-20 20:00:44 +00:00
parent f1464065b5
commit 2e1628641c
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -1,6 +1,7 @@
import asyncio
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers.interval import IntervalTrigger
from .todoist_assigned_issues import todoist_assigned_issues
from .todoist_repo_prs import todoist_repo_prs
@ -10,6 +11,11 @@ def create_scheduler():
scheduler = AsyncIOScheduler()
scheduler.add_job(todoist_assigned_issues, 'interval', minutes=15)
scheduler.add_job(todoist_repo_prs, 'interval', minutes=15)
for job in scheduler.get_jobs():
if isinstance(job.trigger, IntervalTrigger):
scheduler.add_job(job.func)
return scheduler