From d2003709751194d6ec270eb25379bbdb78cb5d3a Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 6 Dec 2021 23:49:27 +0100 Subject: [PATCH] fix(backend): Use new scheduler plugin for assign_backups --- backend/flaschengeist_events/event_controller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/flaschengeist_events/event_controller.py b/backend/flaschengeist_events/event_controller.py index 383bf59..89d81a5 100644 --- a/backend/flaschengeist_events/event_controller.py +++ b/backend/flaschengeist_events/event_controller.py @@ -10,7 +10,7 @@ from sqlalchemy.orm.util import was_deleted from flaschengeist import logger from flaschengeist.database import db from flaschengeist.plugins import before_delete_user -from flaschengeist.utils.scheduler import scheduled +from flaschengeist.plugins.scheduler import scheduled from . import EventPlugin from .models import EventType, Event, Invitation, Job, JobType, Service @@ -386,12 +386,12 @@ def respond_invitation(invite: Invitation, accepted=True): ) -@scheduled +@scheduled(id='dev.flaschengeist.events.assign_backups', minutes=30) def assign_backups(): - logger.debug("Notifications") now = datetime.now(tz=timezone.utc) # now + backup_time + next cron tick start = now + timedelta(hours=16) + timedelta(minutes=30) + services = Service.query.filter(Service.is_backup == True).join(Job).filter(Job.start <= start).all() for service in services: if service.job_.start <= now or service.job_.is_full():