From cb272aa8e1381d830a98d9ce389e26c0053ddb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Thu, 23 May 2024 20:46:32 +0200 Subject: [PATCH] Make live config update interval configurable --- config/api_example_config.py | 2 ++ src/api/live_config.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/api_example_config.py b/config/api_example_config.py index 1189d7a..0465506 100644 --- a/config/api_example_config.py +++ b/config/api_example_config.py @@ -98,6 +98,8 @@ DEFAULT_CACHE_CONTROL_MAX_AGE_SECONDS = 5 * 60 API_DIAGNOSTICS_HISTORY_SIZE_MINUTES = 7 * 24 * 60 API_DIAGNOSTICS_INTERVAL_SIZE_MINUTES = 30 +LIVE_CONFIG_UPDATE_INTERVAL_SECONDS = 60 + # LDAP_HOST = "auth.fsmpi.rwth-aachen.de" LDAP_PORT = 636 LDAP_GROUPS = ["fachschaft"] diff --git a/src/api/live_config.py b/src/api/live_config.py index 8bb05cc..aba2dfe 100644 --- a/src/api/live_config.py +++ b/src/api/live_config.py @@ -1,6 +1,7 @@ import os from pathlib import Path +import api from api.miscellaneous import * from api.objects.types import TYPE_STRING_LONG @@ -68,7 +69,7 @@ class LiveConfig: config: LiveConfig = LiveConfig() -@scheduled_function(10, 1) +@scheduled_function(api.config["LIVE_CONFIG_UPDATE_INTERVAL_SECONDS"], 1) def _update_live_config(): if _LIVE_CONFIG_PATH is None: return -- GitLab