Fixed taking notification update timer mins value from config.py

This commit is contained in:
Daniel Schick 2026-01-14 16:40:48 +01:00
parent d63a26fff9
commit ca44f0d154
2 changed files with 7 additions and 3 deletions

View File

@ -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.')

View File

@ -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)