-
Notifications
You must be signed in to change notification settings - Fork 530
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 contributors views #3091
Cache contributors views #3091
Conversation
@@ -1,7 +1,10 @@ | |||
from django.urls import path, register_converter | |||
from django.urls.converters import StringConverter | |||
from django.views.decorators.cache import cache_page |
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.
Django docs recommend to specify the per-view cache in the URLconf rather than next to the view functions themselves.
@@ -70,7 +73,9 @@ | |||
# Team contributors | |||
path( | |||
"contributors/", |
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.
As per the docs, if multiple URLs point at the same view, each URL will be cached separately.
In this example, /de/contributors/
and /it/contributors/
will be cached separately, as you may expect. But once a particular URL has been requested, subsequent requests to that URL will use the cache.
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 pretty straight-forward. My only (very minor) quibble is over the "per view" part of the PER_VIEW_CACHE_TIMEOUT
variable, which is ultimately clear in context, but I was initially parsing it as something like "per user visit", which wouldn't really make sense.
Renamed |
This patch caches all Contributors views for a period of 1 day:
It mostly fixes #3082, but I'll keep the issue open until I check if there's something we can do to speed up the Authors and Time Range filters.
If this works well, we should cache the Insights views.
The patch is deployed to stage.