Skip to content
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

Merged
merged 1 commit into from
Aug 19, 2019

Conversation

HammadAhmadWaqas
Copy link
Member

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:

  1. Open page A
  2. Do thing B
  3. Expect C to happen
  4. If D happened instead - check failed.

Merge checklist:

  • New requirements are in the right place
    • 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.
  • Regenerate requirements with make upgrade && make requirements (and make sure to fix any errors).
    DO NOT just add dependencies to requirements/*.txt files.
  • Called make static for webpack bundling if any static content was updated.
  • All reviewers approved
  • CI build is green
  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are (reasonably) squashed
  • Translations are updated
  • PR author is listed in AUTHORS

Post merge:

  • Create a tag
  • Check new version is pushed to PyPi after tag-triggered build is finished.
  • Delete working branch (if not needed anymore)
  • edx-platform PR (be sure to include edx-platform requirements upgrades that were present in this PR)

Author concerns: List any concerns about this PR - inelegant
solutions, hacks, quick-and-dirty implementations, concerns about
migrations, etc.

@HammadAhmadWaqas HammadAhmadWaqas changed the title setting cache for get_catalog_results from discovery ENT-2168 | setting cache for get_catalog_results from discovery Aug 9, 2019
Copy link
Contributor

@ziafazal ziafazal left a 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

query_params,
traverse_pagination
)
cache.set(cache_key, response, settings.DISCOVERY_GET_CATALOG_RESULT_CACHE_TIMEOUT)
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

@@ -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):
Copy link
Contributor

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?

@HammadAhmadWaqas HammadAhmadWaqas force-pushed the hammad/ENT-2168 branch 2 times, most recently from 3391db5 to 95f6f7c Compare August 9, 2019 14:08
Copy link
Contributor

@ziafazal ziafazal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

@schenedx schenedx left a 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?

@HammadAhmadWaqas
Copy link
Member Author

@schenedx it appears _load_data calls get_edx_api_data function which has built-in cache support.

Copy link

@schenedx schenedx left a 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.

@HammadAhmadWaqas HammadAhmadWaqas merged commit 316da6c into master Aug 19, 2019
iloveagent57 pushed a commit that referenced this pull request Jun 7, 2022
…a-to-4.2.4

chore: upgrade edx-enterprise-data to 4.2.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants