From a1c602e2f317e88f7cc81c32ea33c38421a03f7c Mon Sep 17 00:00:00 2001 From: Amirouche Date: Mon, 5 Feb 2024 09:05:51 +0100 Subject: [PATCH] small fixes --- api/app.py | 2 +- api/crons/core_dynamic_crons.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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 = [