removing thread-local cache for branch_setting
This commit is contained in:
@@ -135,10 +135,6 @@ class ModuleI18nService(object):
|
||||
return strftime_localized(*args, **kwargs)
|
||||
|
||||
|
||||
# thread local cache
|
||||
_THREAD_CACHE = threading.local()
|
||||
|
||||
|
||||
def _get_modulestore_branch_setting():
|
||||
"""
|
||||
Returns the branch setting for the module store from the current Django request if configured,
|
||||
@@ -166,7 +162,6 @@ def _get_modulestore_branch_setting():
|
||||
branch = getattr(settings, 'MODULESTORE_BRANCH', None)
|
||||
return branch
|
||||
|
||||
# cache the branch setting for this thread so we don't have to recompute it each time
|
||||
if not hasattr(_THREAD_CACHE, 'branch_setting'):
|
||||
_THREAD_CACHE.branch_setting = get_branch_setting()
|
||||
return _THREAD_CACHE.branch_setting
|
||||
# leaving this in code structured in closure-friendly format b/c we might eventually cache this (again)
|
||||
# using request_cache
|
||||
return get_branch_setting()
|
||||
|
||||
@@ -47,16 +47,6 @@ class CoursesTest(ModuleStoreTestCase):
|
||||
|
||||
class ModuleStoreBranchSettingTest(ModuleStoreTestCase):
|
||||
"""Test methods related to the modulestore branch setting."""
|
||||
def cleanup_branch_setting(self):
|
||||
if hasattr(store_django._THREAD_CACHE, 'branch_setting'):
|
||||
delattr(store_django._THREAD_CACHE, 'branch_setting')
|
||||
|
||||
def setUp(self):
|
||||
self.cleanup_branch_setting()
|
||||
|
||||
def tearDown(self):
|
||||
self.cleanup_branch_setting()
|
||||
|
||||
@mock.patch(
|
||||
'xmodule.modulestore.django.get_current_request_hostname',
|
||||
mock.Mock(return_value='preview.localhost')
|
||||
|
||||
Reference in New Issue
Block a user