From f54e3752fa1a3ecc8b272fe9044c536a7c1f14a5 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Mon, 8 Mar 2021 08:47:30 -0500 Subject: [PATCH] fix: lower bundle cache timeout from 47hrs to 50mins (#26863) S3 URLs served by Blockstore have a max TTL of 1hr, since the temporary credentials the Blockstore uses to sign the URLs themselves have a TTL of 1hr. Thus, we must cache Blockstore bundles for less than 1hr. TNL-7771 --- cms/envs/common.py | 11 +++++++++-- lms/envs/common.py | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index f94bd30ad7..bbddc17434 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2275,8 +2275,15 @@ BLOCKSTORE_API_URL = 'http://localhost:18250/api/v1/' # in the blockstore-based XBlock runtime XBLOCK_RUNTIME_V2_EPHEMERAL_DATA_CACHE = 'default' -# Blockstore data could contain S3 links, so this should be lower than Blockstore's AWS_QUERYSTRING_EXPIRE -BLOCKSTORE_BUNDLE_CACHE_TIMEOUT = 169200 +# .. setting_name: BLOCKSTORE_BUNDLE_CACHE_TIMEOUT +# .. setting_default: 3000 +# .. setting_description: Maximum time-to-live of cached Bundles fetched from +# Blockstore, in seconds. When the values returned from Blockstore have +# TTLs of their own (such as signed S3 URLs), the maximum TTL of this cache +# must be lower than the minimum TTL of those values. +# We use a default of 3000s (50mins) because temporary URLs are often +# configured to expire after one hour. +BLOCKSTORE_BUNDLE_CACHE_TIMEOUT = 3000 ###################### LEARNER PORTAL ################################ LEARNER_PORTAL_URL_ROOT = 'https://learner-portal-localhost:18000' diff --git a/lms/envs/common.py b/lms/envs/common.py index 01f5e55c11..fa90ab3dd5 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -4612,8 +4612,15 @@ BLOCKSTORE_API_URL = 'http://localhost:18250/api/v1/' # .. setting_description: The django cache key of the cache to use for storing anonymous user state for XBlocks. XBLOCK_RUNTIME_V2_EPHEMERAL_DATA_CACHE = 'default' -# Blockstore data could contain S3 links, so this should be lower than Blockstore's AWS_QUERYSTRING_EXPIRE -BLOCKSTORE_BUNDLE_CACHE_TIMEOUT = 169200 +# .. setting_name: BLOCKSTORE_BUNDLE_CACHE_TIMEOUT +# .. setting_default: 3000 +# .. setting_description: Maximum time-to-live of cached Bundles fetched from +# Blockstore, in seconds. When the values returned from Blockstore have +# TTLs of their own (such as signed S3 URLs), the maximum TTL of this cache +# must be lower than the minimum TTL of those values. +# We use a default of 3000s (50mins) because temporary URLs are often +# configured to expire after one hour. +BLOCKSTORE_BUNDLE_CACHE_TIMEOUT = 3000 ######################### MICROSITE ############################### MICROSITE_ROOT_DIR = '/edx/app/edxapp/edx-microsite'