From 5279975483a9b650cd4cc3dca66c03980afec6ce Mon Sep 17 00:00:00 2001 From: Raul Gallegos Date: Fri, 11 Dec 2020 09:35:45 -0500 Subject: [PATCH] [TNL-7771][LX-1409] sets blockstore values timeouts to avoid S3 links expiration (#25830) --- cms/envs/common.py | 3 +++ lms/envs/common.py | 3 +++ openedx/core/djangolib/blockstore_cache.py | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index 2b5b556def..7dd9d6d6eb 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2214,6 +2214,9 @@ 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 + ###################### LEARNER PORTAL ################################ LEARNER_PORTAL_URL_ROOT = 'https://learner-portal-localhost:18000' diff --git a/lms/envs/common.py b/lms/envs/common.py index b6fb92c1fd..ec97c9cff9 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -4143,6 +4143,9 @@ 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 + ######################### MICROSITE ############################### MICROSITE_ROOT_DIR = '/edx/app/edxapp/edx-microsite' MICROSITE_CONFIGURATION = {} diff --git a/openedx/core/djangolib/blockstore_cache.py b/openedx/core/djangolib/blockstore_cache.py index bbd482e9e5..84aefb09c4 100644 --- a/openedx/core/djangolib/blockstore_cache.py +++ b/openedx/core/djangolib/blockstore_cache.py @@ -12,6 +12,7 @@ and won't find the now-invalid cached data. from datetime import datetime from uuid import UUID +from django.conf import settings from django.core.cache import caches, InvalidCacheBackendError from pytz import UTC import requests @@ -81,7 +82,7 @@ class BundleCache(object): """ assert isinstance(key_parts, (list, tuple)) full_key = _get_versioned_cache_key(self.bundle_uuid, self.draft_name, key_parts) - return cache.set(full_key, value, timeout=None) + return cache.set(full_key, value, timeout=settings.BLOCKSTORE_BUNDLE_CACHE_TIMEOUT) def clear(self): """