-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENT-2168 | setting cache for get_catalog_results from discovery #545
Conversation
2256e6e
to
f4c9ee4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HammadAhmadWaqas added missing commments
enterprise/api_client/discovery.py
Outdated
query_params, | ||
traverse_pagination | ||
) | ||
cache.set(cache_key, response, settings.DISCOVERY_GET_CATALOG_RESULT_CACHE_TIMEOUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of creating DISCOVERY_GET_CATALOG_RESULT_CACHE_TIMEOUT
in this we should use ENTERPRISE_API_CACHE_TIMEOUT
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ENTERPRISE_API_CACHE_TIMEOUT is used for API that belongs to Enterprise. That is why we are using it in EnterpriseApiClient.
But now we want some TimeOut period for Discovery to use in CourseCatalogApiClient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That time out ENTERPRISE_API_CACHE_TIMEOUT
is used in cache results of discovery call. since that enterprise API is calling discovery.
enterprise/api_client/discovery.py
Outdated
@@ -116,10 +118,20 @@ def traverse_pagination(response, endpoint, content_filter_query, query_params): | |||
|
|||
return results | |||
|
|||
def get_catalog_results(self, content_filter_query, query_params=None, traverse_pagination=False): | |||
def _get_catalog_results_from_discovery(self, content_filter_query, query_params=None, traverse_pagination=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using _get_catalog_results_from_discovery
in tests can we remove underscore prefix from its name?
3391db5
to
95f6f7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
95f6f7c
to
2420d53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HammadAhmadWaqas Thank you for the quick turn around on this fix.
I believe we should also set the cache on the _load_data
function. That's where a bunch of other catalog api calls are piped through, like get_course_run
and get_course_id
. Could you please add your cache mechanism on those as well?
@schenedx it appears |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HammadAhmadWaqas I didn't know that. It explains about the difference of logs I see between edx-enterprise calls on discovery, and the actual discovery logs.
Let's deploy this change and see if this indeed fixes the performance issue associated with enterprise course enrollment.
…a-to-4.2.4 chore: upgrade edx-enterprise-data to 4.2.4
Description: setting cache for get_catalog_results from discovery
JIRA: https://openedx.atlassian.net/browse/ENT-2168
Dependencies: dependencies on other outstanding PRs, issues, etc.
Merge deadline: List merge deadline (if any)
Installation instructions: List any non-trivial installation
instructions.
Testing instructions:
Merge checklist:
base.in
if needed in production, but edx-platform doesn't install it.test-master.in
if edx-platform pins it, with a matching version.make upgrade && make requirements
(and make sure to fix any errors).DO NOT just add dependencies to
requirements/*.txt
files.make static
for webpack bundling if any static content was updated.Post merge:
Author concerns: List any concerns about this PR - inelegant
solutions, hacks, quick-and-dirty implementations, concerns about
migrations, etc.