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():