diff --git a/openedx/core/djangoapps/content/search/api.py b/openedx/core/djangoapps/content/search/api.py index 0a42c190ad34..8541873b6b14 100644 --- a/openedx/core/djangoapps/content/search/api.py +++ b/openedx/core/djangoapps/content/search/api.py @@ -117,11 +117,9 @@ def _get_meili_api_key_uid(): Helper method to get the UID of the API key we're using for Meilisearch """ global _MEILI_API_KEY_UID # pylint: disable=global-statement - - if _MEILI_API_KEY_UID is not None: - return _MEILI_API_KEY_UID - - _MEILI_API_KEY_UID = _get_meilisearch_client().get_key(settings.MEILISEARCH_API_KEY).uid + if _MEILI_API_KEY_UID is None: + _MEILI_API_KEY_UID = _get_meilisearch_client().get_key(settings.MEILISEARCH_API_KEY).uid + return _MEILI_API_KEY_UID def _wait_for_meili_task(info: TaskInfo) -> None: