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
d37499c2
Commit
d37499c2
authored
May 20, 2016
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hotfix for BlockStructure data not being invalidated upon Course Publish.
parent
01fca6b6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
openedx/core/djangoapps/content/course_structures/tasks.py
+10
-0
openedx/core/lib/block_structure/cache.py
+4
-4
openedx/core/lib/block_structure/tests/test_cache.py
+1
-1
No files found.
openedx/core/djangoapps/content/course_structures/tasks.py
View file @
d37499c2
...
...
@@ -96,3 +96,13 @@ def update_course_structure(course_key):
structure_model
.
structure_json
=
structure_json
structure_model
.
discussion_id_map_json
=
discussion_id_map_json
structure_model
.
save
()
# TODO (TNL-4630) For temporary hotfix to update the block_structure cache.
# Should be moved to proper location.
from
django.core.cache
import
cache
from
openedx.core.lib.block_structure.manager
import
BlockStructureManager
store
=
modulestore
()
course_usage_key
=
store
.
make_course_usage_key
(
course_key
)
block_structure_manager
=
BlockStructureManager
(
course_usage_key
,
store
,
cache
)
block_structure_manager
.
update_collected
()
openedx/core/lib/block_structure/cache.py
View file @
d37499c2
...
...
@@ -45,13 +45,13 @@ class BlockStructureCache(object):
)
zp_data_to_cache
=
zpickle
(
data_to_cache
)
# Set the timeout value for the cache to
None. This caches th
e
#
value forever. The expectation is that the caller will delete
# the cached value once it is outdated.
# Set the timeout value for the cache to
1 day as a fail-saf
e
#
in case the signal to invalidate the cache doesn't come through.
timeout_in_seconds
=
60
*
60
*
24
self
.
_cache
.
set
(
self
.
_encode_root_cache_key
(
block_structure
.
root_block_usage_key
),
zp_data_to_cache
,
timeout
=
None
,
timeout
=
timeout_in_seconds
,
)
logger
.
info
(
...
...
openedx/core/lib/block_structure/tests/test_cache.py
View file @
d37499c2
...
...
@@ -36,7 +36,7 @@ class TestBlockStructureCache(ChildrenMapTestMixin, TestCase):
self
.
add_transformers
()
self
.
block_structure_cache
.
add
(
self
.
block_structure
)
self
.
assertEquals
(
self
.
mock_cache
.
timeout_from_last_call
,
None
)
self
.
assertEquals
(
self
.
mock_cache
.
timeout_from_last_call
,
60
*
60
*
24
)
cached_value
=
self
.
block_structure_cache
.
get
(
self
.
block_structure
.
root_block_usage_key
)
self
.
assertIsNotNone
(
cached_value
)
...
...
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