diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py index d8de53452d697f73735510e985f4acc11109fbee..c12915a620819926f29d0c337ecb7e3b054e9721 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py @@ -981,8 +981,10 @@ class TestCourseStructureCache(SplitModuleTest): cache_key = self.new_course.id.version_guid self.cache.set(cache_key, b"bad_data") with check_mongo_calls(1): - not_cached_structure = self._get_structure(self.new_course) + not_corrupt_structure = self._get_structure(self.new_course) + # now make sure that you get the same structure + self.assertEqual(not_corrupt_structure, not_cached_structure) @patch('xmodule.modulestore.split_mongo.mongo_connection.get_cache') def test_course_structure_cache_no_cache_configured(self, mock_get_cache): diff --git a/openedx/core/djangoapps/content/block_structure/store.py b/openedx/core/djangoapps/content/block_structure/store.py index aa4d90d481bee282d4d0ba5980d7192741be85ae..43de5cc4786f20437744df1c98aa3b17346bfbb8 100644 --- a/openedx/core/djangoapps/content/block_structure/store.py +++ b/openedx/core/djangoapps/content/block_structure/store.py @@ -213,7 +213,7 @@ class BlockStructureStore(object): except Exception: # Somehow failed to de-serialized the data, assume it's corrupt. bs_model = self._get_model(root_block_usage_key) - logger.warning("BlockStructure: Failed to load data from cache for %s", bs_model) + logger.exception("BlockStructure: Failed to load data from cache for %s", bs_model) raise BlockStructureNotFound(bs_model.data_usage_key) return BlockStructureFactory.create_new( diff --git a/openedx/core/lib/edx_api_utils.py b/openedx/core/lib/edx_api_utils.py index e927dbaf5d5859688a345db9d349566def93e7f2..3c9ca66f4279cceaf0ce279b543df591c9e58a7e 100644 --- a/openedx/core/lib/edx_api_utils.py +++ b/openedx/core/lib/edx_api_utils.py @@ -58,14 +58,15 @@ def get_edx_api_data(api_config, resource, api, resource_id=None, querystring=No if cached: try: cached_response = zunpickle(cached) - if fields: - cached_response = get_fields(fields, cached_response) - - return cached_response except Exception: # Data is corrupt in some way. log.warning("Data for cache is corrupt for cache key %s", cache_key) cache.delete(cache_key) + else: + if fields: + cached_response = get_fields(fields, cached_response) + + return cached_response try: endpoint = getattr(api, resource)