From c7794142d49d11966d983542b49a8d91e3872fef Mon Sep 17 00:00:00 2001 From: Ahsan Ulhaq Date: Tue, 31 Jul 2018 17:16:11 +0500 Subject: [PATCH] Updated log to check which site cache are miss LEARNER-5967 --- openedx/core/djangoapps/catalog/tests/test_utils.py | 4 +++- openedx/core/djangoapps/catalog/utils.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/catalog/tests/test_utils.py b/openedx/core/djangoapps/catalog/tests/test_utils.py index 60ebb2a29e..7f47a855ca 100644 --- a/openedx/core/djangoapps/catalog/tests/test_utils.py +++ b/openedx/core/djangoapps/catalog/tests/test_utils.py @@ -66,7 +66,9 @@ class TestGetPrograms(CacheIsolationTestCase): # When called before UUIDs are cached, the function should return an # empty list and log a warning. self.assertEqual(get_programs(self.site), []) - mock_warning.assert_called_once_with('Failed to get program UUIDs from the cache.') + mock_warning.assert_called_once_with( + 'Failed to get program UUIDs from the cache for site {}.'.format(self.site.domain) + ) mock_warning.reset_mock() # Cache UUIDs for all 3 programs. diff --git a/openedx/core/djangoapps/catalog/utils.py b/openedx/core/djangoapps/catalog/utils.py index 51cf34ce11..86d4d12cff 100644 --- a/openedx/core/djangoapps/catalog/utils.py +++ b/openedx/core/djangoapps/catalog/utils.py @@ -63,7 +63,7 @@ def get_programs(site, uuid=None): return program uuids = cache.get(SITE_PROGRAM_UUIDS_CACHE_KEY_TPL.format(domain=site.domain), []) if not uuids: - logger.warning('Failed to get program UUIDs from the cache.') + logger.warning('Failed to get program UUIDs from the cache for site {}.'.format(site.domain)) programs = cache.get_many([PROGRAM_CACHE_KEY_TPL.format(uuid=uuid) for uuid in uuids]) programs = list(programs.values())