From ca44f0d154076f73335c17c42d2051d395c541d4 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 14 Jan 2026 16:40:48 +0100 Subject: [PATCH] Fixed taking notification update timer mins value from config.py --- src/server/BreCal/__init__.py | 6 +++++- src/server/BreCal/services/schedule_routines.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/server/BreCal/__init__.py b/src/server/BreCal/__init__.py index ed16a4f..964f5b9 100644 --- a/src/server/BreCal/__init__.py +++ b/src/server/BreCal/__init__.py @@ -16,6 +16,7 @@ from .api import user from .api import history from .api import ports +from BreCal.schemas import defs from BreCal.brecal_utils.file_handling import get_project_root, ensure_path from BreCal.brecal_utils.test_handling import execute_test_with_pytest, execute_coverage_test from BreCal.brecal_utils.time_handling import difference_to_then @@ -86,7 +87,10 @@ def create_app(test_config=None, instance_path=None): logging.info('App started') # Setup Routine jobs (e.g., reevaluation of shipcalls) - setup_schedule(update_shipcalls_interval_in_minutes=app.config.get("SCHEDULE_UPDATE_SHIPCALLS_MINUTES", 60)) + setup_schedule( + update_shipcalls_interval_in_minutes=app.config.get("SCHEDULE_UPDATE_SHIPCALLS_MINUTES", 60), + notification_cooldown_mins=app.config.get("NOTIFICATION_COOLDOWN_MINS", defs.NOTIFICATION_COOLDOWN_MINS), + ) run_schedule_permanently_in_background(latency=app.config.get("SCHEDULE_BACKGROUND_LATENCY_SECONDS", 30)) logging.info('Routine Jobs are defined.') diff --git a/src/server/BreCal/services/schedule_routines.py b/src/server/BreCal/services/schedule_routines.py index 99118c7..e778d58 100644 --- a/src/server/BreCal/services/schedule_routines.py +++ b/src/server/BreCal/services/schedule_routines.py @@ -370,7 +370,7 @@ def eval_next_24_hrs(): return -def setup_schedule(update_shipcalls_interval_in_minutes:int=60): +def setup_schedule(update_shipcalls_interval_in_minutes:int=60, notification_cooldown_mins:int=defs.NOTIFICATION_COOLDOWN_MINS): logging.getLogger('schedule').setLevel(logging.INFO); # set the logging level of the schedule module to INFO @@ -379,7 +379,7 @@ def setup_schedule(update_shipcalls_interval_in_minutes:int=60): # update the evaluation state in every recent shipcall add_function_to_schedule__update_shipcalls(update_shipcalls_interval_in_minutes) - add_function_to_evaluate_notifications(defs.NOTIFICATION_COOLDOWN_MINS) + add_function_to_evaluate_notifications(notification_cooldown_mins) add_function_to_clear_notifications(defs.NOTIFICATION_MAX_AGE_DAYS)