diff --git a/app/service/app_svc.py b/app/service/app_svc.py index 53e0b1f41..3b82a5389 100644 --- a/app/service/app_svc.py +++ b/app/service/app_svc.py @@ -4,6 +4,7 @@ import hashlib import json import os +import re import time from collections import namedtuple from datetime import datetime, timezone @@ -84,6 +85,12 @@ async def run_scheduler(self): interval = 60 for s in await self.get_service('data_svc').locate('schedules'): now = datetime.now(timezone.utc) + match = re.match(r'^(\d{2}):(\d{2}):\d{2}\.\d{6}$', s.schedule) + if match: + hour, minute = match.groups() + s.schedule = f"{minute} {hour} * * *" + self.log.info(f"Converted time schedule {s.id} to cron format: {s.schedule}") + if not croniter.croniter.is_valid(s.schedule): self.log.warning(f"The schedule {s.id} with the format `{s.schedule}` is incompatible with cron!") continue