From 663f9a223dd04e272ebd8b0f44c6fcc997be36ed Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Mon, 1 Sep 2025 10:30:57 -0500 Subject: [PATCH] Fixes: #19825 - Prevent cache for config revisions from being overwritten when in debug mode when not intended --- netbox/core/apps.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netbox/core/apps.py b/netbox/core/apps.py index c081fb064..aeb41bfe3 100644 --- a/netbox/core/apps.py +++ b/netbox/core/apps.py @@ -42,6 +42,13 @@ class CoreConfig(AppConfig): # Clear Redis cache on startup in development mode if settings.DEBUG: try: + config = cache.get('config') + config_version = cache.get('config_version') cache.clear() + if config_version: + # Activate the current config revision + # Do not query DB due to apps still initializing + cache.set('config', config, None) + cache.set('config_version', config_version, None) except Exception: pass