diff --git a/api/app.py b/api/app.py index 15371be2a..0ca4ea209 100644 --- a/api/app.py +++ b/api/app.py @@ -37,7 +37,7 @@ async def lifespan(app: FastAPI): ap_logger.setLevel(loglevel) app.schedule = AsyncIOScheduler() - await pg_client.init() + pg_client.init() app.schedule.start() for job in core_crons.cron_jobs + core_dynamic_crons.cron_jobs: diff --git a/api/crons/core_dynamic_crons.py b/api/crons/core_dynamic_crons.py index 9703ce256..418094d90 100644 --- a/api/crons/core_dynamic_crons.py +++ b/api/crons/core_dynamic_crons.py @@ -1,3 +1,4 @@ +import asyncio from apscheduler.triggers.cron import CronTrigger from apscheduler.triggers.interval import IntervalTrigger @@ -6,23 +7,23 @@ from chalicelib.core import weekly_report, jobs, health def run_scheduled_jobs() -> None: - jobs.execute_jobs() + asyncio.run(jobs.execute_jobs()) def weekly_report_cron() -> None: - weekly_report.cron() + asyncio.run(weekly_report.cron()) def telemetry_cron() -> None: - telemetry.compute() + asyncio.run(telemetry.compute()) def health_cron() -> None: - health.cron() + asyncio.run(health.cron()) def weekly_health_cron() -> None: - health.weekly_cron() + asyncio.run(health.weekly_cron()) cron_jobs = [