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
f143b7f0
Commit
f143b7f0
authored
Feb 11, 2015
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move lazy-loading override logic into cache_items and add explanation.
parent
1b66b1a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+11
-5
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
f143b7f0
...
...
@@ -688,8 +688,14 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
new_module_data
)
if
not
lazy
:
# Load all descendants by id
# This code supports lazy loading, where the descendent definitions aren't loaded
# until they're actually needed.
# However, assume that depth == 0 means no depth is specified and depth != 0 means
# a depth *is* specified. If a non-zero depth is specified, force non-lazy definition
# loading in order to populate the definition cache for later access.
load_definitions_now
=
depth
!=
0
or
not
lazy
if
load_definitions_now
:
# Non-lazy loading: Load all descendants by id.
descendent_definitions
=
self
.
get_definitions
(
course_key
,
[
...
...
@@ -697,14 +703,14 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
for
block
in
new_module_data
.
itervalues
()
]
)
#
turn into a map
#
Turn definitions into a map.
definitions
=
{
definition
[
'_id'
]:
definition
for
definition
in
descendent_definitions
}
for
block
in
new_module_data
.
itervalues
():
if
block
.
definition
in
definitions
:
definition
=
definitions
[
block
.
definition
]
# convert_fields
was being done here, but it
gets done later in the runtime's xblock_from_json
# convert_fields gets done later in the runtime's xblock_from_json
block
.
fields
.
update
(
definition
.
get
(
'fields'
))
block
.
definition_loaded
=
True
...
...
@@ -723,7 +729,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
if
runtime
is
None
:
runtime
=
self
.
create_runtime
(
course_entry
,
lazy
)
self
.
_add_cache
(
course_entry
.
structure
[
'_id'
],
runtime
)
self
.
cache_items
(
runtime
,
block_keys
,
course_entry
.
course_key
,
depth
,
depth
==
0
and
lazy
)
self
.
cache_items
(
runtime
,
block_keys
,
course_entry
.
course_key
,
depth
,
lazy
)
return
[
runtime
.
load_item
(
block_key
,
course_entry
,
**
kwargs
)
for
block_key
in
block_keys
]
...
...
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