Updated log to check which site cache are miss

LEARNER-5967
This commit is contained in:
Ahsan Ulhaq
2018-07-31 17:16:11 +05:00
parent 94e71b1800
commit c7794142d4
2 changed files with 4 additions and 2 deletions

View File

@@ -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.

View File

@@ -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())