-
Notifications
You must be signed in to change notification settings - Fork 3
Cache unit page counts #1507
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
Cache unit page counts #1507
Conversation
mbertrand
left a comment
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.
Looks great, only question is regarding this:
which get invalidated when new resources are fetched
I'm not seeing that, if I add new OCW courses, the OCW count remains the same. Should the cache get invalidated when courses are added?
mbertrand
left a comment
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.
Cache is invalidated now after adding more courses, 👍
|
|
||
|
|
||
| class ChannelCountsSerializer(serializers.ModelSerializer): | ||
| counts = serializers.SerializerMethodField(read_only=True) |
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.
Could use a docstring
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/5246
Description (What does it do?)
Currently the "programs" and "courses counts displayed on the unit page(/units/) comes from opensearch aggregations which has been determined to be expensive for just getting counts of things that change infrequently. This PR moves the counts off to their own endpoint which is then cached and invalidated along with learning resources (which get invalidated when new resources are fetched).
How can this be tested?