From 9723d751b48634af36b6f79a77cf2676a81018ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Wed, 20 Mar 2024 11:55:14 -0300 Subject: [PATCH] fix: check if Meilisearch is enabled before return client Co-authored-by: Yusuf Musleh --- openedx/core/djangoapps/content/search/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/content/search/api.py b/openedx/core/djangoapps/content/search/api.py index 919d14455cee..7628812206f5 100644 --- a/openedx/core/djangoapps/content/search/api.py +++ b/openedx/core/djangoapps/content/search/api.py @@ -81,12 +81,12 @@ def _get_meilisearch_client(): """ global _MEILI_CLIENT # pylint: disable=global-statement - if _MEILI_CLIENT is not None: - return _MEILI_CLIENT - # Connect to Meilisearch if not settings.MEILISEARCH_ENABLED: raise RuntimeError("MEILISEARCH_ENABLED is not set - search functionality disabled.") + + if _MEILI_CLIENT is not None: + return _MEILI_CLIENT _MEILI_CLIENT = meilisearch.Client(settings.MEILISEARCH_URL, settings.MEILISEARCH_API_KEY) try: