fix: revert back the bundle_draft_files cache key (#26897)

Changes the LMS/Studio bundle cache key,
thus invalidating all 47hr-TTL entries
in favor of new 50min-TTL entries.

TNL-7771
This commit is contained in:
Raul Gallegos
2021-03-08 12:34:51 -05:00
committed by GitHub
parent aecf6f1d51
commit e1614b5324

View File

@@ -147,7 +147,7 @@ def get_bundle_version_number(bundle_uuid, draft_name=None):
# Cache the draft files using the version. This saves an API call when the draft is first retrieved.
draft_files = list(draft_metadata.files.values())
draft_files_cache_key = _construct_versioned_cache_key(
bundle_uuid, version, ('bundle_draft_files_v2', ), draft_name)
bundle_uuid, version, ('bundle_draft_files', ), draft_name)
cache.set(draft_files_cache_key, draft_files)
# If we're not using a draft or the draft does not exist [anymore], fall
# back to the bundle version, if any versions have been published:
@@ -183,8 +183,7 @@ def get_bundle_draft_files_cached(bundle_uuid, draft_name):
"""
bundle_cache = BundleCache(bundle_uuid, draft_name)
# This key is `_v2` to avoid reading invalid values cached by a past version of this code with no timeout.
cache_key = ('bundle_draft_files_v2', )
cache_key = ('bundle_draft_files', )
result = bundle_cache.get(cache_key)
if result is None:
result = list(blockstore_api.get_bundle_files(bundle_uuid, use_draft=draft_name))