Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
be80e005
Commit
be80e005
authored
Jul 17, 2014
by
Jason Bau
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4464 from edx/jbau/remove-branch-setting-cache
removing thread-local cache for branch_setting
parents
e81c33ce
f12fa05a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
18 deletions
+3
-18
common/lib/xmodule/xmodule/modulestore/django.py
+3
-8
lms/djangoapps/courseware/tests/test_courses.py
+0
-10
No files found.
common/lib/xmodule/xmodule/modulestore/django.py
View file @
be80e005
...
@@ -136,10 +136,6 @@ class ModuleI18nService(object):
...
@@ -136,10 +136,6 @@ class ModuleI18nService(object):
return
strftime_localized
(
*
args
,
**
kwargs
)
return
strftime_localized
(
*
args
,
**
kwargs
)
# thread local cache
_THREAD_CACHE
=
threading
.
local
()
def
_get_modulestore_branch_setting
():
def
_get_modulestore_branch_setting
():
"""
"""
Returns the branch setting for the module store from the current Django request if configured,
Returns the branch setting for the module store from the current Django request if configured,
...
@@ -167,7 +163,6 @@ def _get_modulestore_branch_setting():
...
@@ -167,7 +163,6 @@ def _get_modulestore_branch_setting():
branch
=
getattr
(
settings
,
'MODULESTORE_BRANCH'
,
None
)
branch
=
getattr
(
settings
,
'MODULESTORE_BRANCH'
,
None
)
return
branch
return
branch
# cache the branch setting for this thread so we don't have to recompute it each time
# leaving this in code structured in closure-friendly format b/c we might eventually cache this (again)
if
not
hasattr
(
_THREAD_CACHE
,
'branch_setting'
):
# using request_cache
_THREAD_CACHE
.
branch_setting
=
get_branch_setting
()
return
get_branch_setting
()
return
_THREAD_CACHE
.
branch_setting
lms/djangoapps/courseware/tests/test_courses.py
View file @
be80e005
...
@@ -47,16 +47,6 @@ class CoursesTest(ModuleStoreTestCase):
...
@@ -47,16 +47,6 @@ class CoursesTest(ModuleStoreTestCase):
class
ModuleStoreBranchSettingTest
(
ModuleStoreTestCase
):
class
ModuleStoreBranchSettingTest
(
ModuleStoreTestCase
):
"""Test methods related to the modulestore branch setting."""
"""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
(
@mock.patch
(
'xmodule.modulestore.django.get_current_request_hostname'
,
'xmodule.modulestore.django.get_current_request_hostname'
,
mock
.
Mock
(
return_value
=
'preview.localhost'
)
mock
.
Mock
(
return_value
=
'preview.localhost'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment