Commit 4a969f9f by Usman Khalid

Added autoretry_read decorator to methods which use mongo cursor.

PLAT-71
parent 328a79cc
......@@ -526,6 +526,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
connection.drop_database(self.collection.database.proxied_object)
connection.close()
@autoretry_read()
def fill_in_run(self, course_key):
"""
In mongo some course_keys are used without runs. This helper function returns
......@@ -699,6 +700,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
item['location'] = item['_id']
del item['_id']
@autoretry_read()
def _query_children_for_cache_children(self, course_key, items):
"""
Generate a pymongo in query for finding the items and return the payloads
......@@ -803,6 +805,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
for item in items
]
@autoretry_read()
def get_courses(self, **kwargs):
'''
Returns a list of course descriptors.
......@@ -934,6 +937,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
for key in ('tag', 'org', 'course', 'category', 'name', 'revision')
])
@autoretry_read()
def get_items(
self,
course_id,
......
......@@ -72,6 +72,7 @@ from xmodule.modulestore.exceptions import InsufficientSpecificationError, Versi
from xmodule.modulestore import (
inheritance, ModuleStoreWriteBase, ModuleStoreEnum, BulkOpsRecord, BulkOperationsMixin
)
from xmodule.modulestore.mongodb_proxy import autoretry_read
from ..exceptions import ItemNotFoundError
from .caching_descriptor_system import CachingDescriptorSystem
......@@ -775,6 +776,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# add it in the envelope for the structure.
return CourseEnvelope(course_key.replace(version_guid=version_guid), entry)
@autoretry_read()
def get_courses(self, branch, **kwargs):
'''
Returns a list of course descriptors matching any given qualifiers.
......@@ -2631,6 +2633,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
"""
structure['blocks'][block_key] = content
@autoretry_read()
def find_courses_by_search_target(self, field_name, field_value):
"""
Find all the courses which cached that they have the given field with the given value.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment