AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): Only try to initialize LaunchDarkly once (#11222)
Reinier van der Leer3da595f5996c
diff --git a/autogpt_platform/backend/backend/util/feature_flag.py b/autogpt_platform/backend/backend/util/feature_flag.pyindex 92625b0be9..06f685102a 100644--- a/autogpt_platform/backend/backend/util/feature_flag.py+++ b/autogpt_platform/backend/backend/util/feature_flag.py@@ -63,9 +63,9 @@ def initialize_launchdarkly() -> None:config = Config(sdk_key)ldclient.set_config(config)+ global _is_initialized+ _is_initialized = Trueif ldclient.get().is_initialized():- global _is_initialized- _is_initialized = Truelogger.info("LaunchDarkly client initialized successfully")else:logger.error("LaunchDarkly client failed to initialize")@@ -218,7 +218,8 @@ def feature_flag(if not get_client().is_initialized():logger.warning(- f"LaunchDarkly not initialized, using default={default}"+ "LaunchDarkly not initialized, "+ f"using default {flag_key}={repr(default)}")is_enabled = defaultelse:@@ -232,8 +233,9 @@ def feature_flag(else:# Log warning and use default for non-boolean valueslogger.warning(- f"Feature flag {flag_key} returned non-boolean value: {flag_value} (type: {type(flag_value).__name__}). "- f"Using default={default}"+ f"Feature flag {flag_key} returned non-boolean value: "+ f"{repr(flag_value)} (type: {type(flag_value).__name__}). "+ f"Using default value {repr(default)}")is_enabled = default