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
fb20312e
Commit
fb20312e
authored
Aug 25, 2016
by
sanfordstudent
Committed by
GitHub
Aug 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13294 from edx/sstudent/TNL-5041
check for null doc
parents
43bbe952
20379c14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
+9
-1
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
View file @
fb20312e
...
@@ -21,6 +21,7 @@ except ImportError:
...
@@ -21,6 +21,7 @@ except ImportError:
DJANGO_AVAILABLE
=
False
DJANGO_AVAILABLE
=
False
import
dogstats_wrapper
as
dog_stats_api
import
dogstats_wrapper
as
dog_stats_api
import
logging
from
contracts
import
check
,
new_contract
from
contracts
import
check
,
new_contract
from
mongodb_proxy
import
autoretry_read
from
mongodb_proxy
import
autoretry_read
...
@@ -31,6 +32,7 @@ from xmodule.mongo_utils import connect_to_mongodb, create_collection_index
...
@@ -31,6 +32,7 @@ from xmodule.mongo_utils import connect_to_mongodb, create_collection_index
new_contract
(
'BlockData'
,
BlockData
)
new_contract
(
'BlockData'
,
BlockData
)
log
=
logging
.
getLogger
(
__name__
)
def
get_cache
(
alias
):
def
get_cache
(
alias
):
...
@@ -315,7 +317,7 @@ class MongoConnection(object):
...
@@ -315,7 +317,7 @@ class MongoConnection(object):
"""
"""
Get the structure from the persistence mechanism whose id is the given key.
Get the structure from the persistence mechanism whose id is the given key.
This method will use a cached version of the structure if it is availble.
This method will use a cached version of the structure if it is avail
a
ble.
"""
"""
with
TIMER
.
timer
(
"get_structure"
,
course_context
)
as
tagger_get_structure
:
with
TIMER
.
timer
(
"get_structure"
,
course_context
)
as
tagger_get_structure
:
cache
=
CourseStructureCache
()
cache
=
CourseStructureCache
()
...
@@ -328,6 +330,12 @@ class MongoConnection(object):
...
@@ -328,6 +330,12 @@ class MongoConnection(object):
with
TIMER
.
timer
(
"get_structure.find_one"
,
course_context
)
as
tagger_find_one
:
with
TIMER
.
timer
(
"get_structure.find_one"
,
course_context
)
as
tagger_find_one
:
doc
=
self
.
structures
.
find_one
({
'_id'
:
key
})
doc
=
self
.
structures
.
find_one
({
'_id'
:
key
})
if
doc
is
None
:
log
.
warning
(
"doc was None when attempting to retrieve structure for item with key
%
s"
,
unicode
(
key
)
)
return
None
tagger_find_one
.
measure
(
"blocks"
,
len
(
doc
[
'blocks'
]))
tagger_find_one
.
measure
(
"blocks"
,
len
(
doc
[
'blocks'
]))
structure
=
structure_from_mongo
(
doc
,
course_context
)
structure
=
structure_from_mongo
(
doc
,
course_context
)
tagger_find_one
.
sample_rate
=
1
tagger_find_one
.
sample_rate
=
1
...
...
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