Commit 1ecba9a9 by muzaffaryousaf

Setting request timeouts for edx notes.

TNL-2444
parent 6541ce3e
......@@ -99,7 +99,8 @@ def send_request(user, course_id, page, page_size, path="", text=None):
headers={
"x-annotator-auth-token": get_edxnotes_id_token(user)
},
params=params
params=params,
timeout=(settings.EDXNOTES_CONNECT_TIMEOUT, settings.EDXNOTES_READ_TIMEOUT)
)
except RequestException:
log.error("Failed to connect to edx-notes-api: url=%s, params=%s", url, str(params))
......
......@@ -782,7 +782,8 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"highlight": True,
'page': 1,
'page_size': 25,
}
},
timeout=(settings.EDXNOTES_CONNECT_TIMEOUT, settings.EDXNOTES_READ_TIMEOUT)
)
@override_settings(EDXNOTES_PUBLIC_API="http://example.com")
......@@ -809,7 +810,8 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"course_id": unicode(self.course.id),
'page': helpers.DEFAULT_PAGE,
'page_size': helpers.DEFAULT_PAGE_SIZE,
}
},
timeout=(settings.EDXNOTES_CONNECT_TIMEOUT, settings.EDXNOTES_READ_TIMEOUT)
)
def test_get_course_position_no_chapter(self):
......
......@@ -723,6 +723,9 @@ PROFILE_IMAGE_DEFAULT_FILENAME = 'images/profiles/default'
EDXNOTES_PUBLIC_API = ENV_TOKENS.get('EDXNOTES_PUBLIC_API', EDXNOTES_PUBLIC_API)
EDXNOTES_INTERNAL_API = ENV_TOKENS.get('EDXNOTES_INTERNAL_API', EDXNOTES_INTERNAL_API)
EDXNOTES_CONNECT_TIMEOUT = ENV_TOKENS.get('EDXNOTES_CONNECT_TIMEOUT', EDXNOTES_CONNECT_TIMEOUT)
EDXNOTES_READ_TIMEOUT = ENV_TOKENS.get('EDXNOTES_READ_TIMEOUT', EDXNOTES_READ_TIMEOUT)
##### Credit Provider Integration #####
CREDIT_PROVIDER_SECRET_KEYS = AUTH_TOKENS.get("CREDIT_PROVIDER_SECRET_KEYS", {})
......
......@@ -1024,6 +1024,9 @@ PAYMENT_REPORT_GENERATOR_GROUP = 'shoppingcart_report_access'
EDXNOTES_PUBLIC_API = 'http://localhost:8120/api/v1'
EDXNOTES_INTERNAL_API = 'http://localhost:8120/api/v1'
EDXNOTES_CONNECT_TIMEOUT = 0.5 # time in seconds
EDXNOTES_READ_TIMEOUT = 1.5 # time in seconds
########################## Parental controls config #######################
# The age at which a learner no longer requires parental consent, or None
......
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