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

Adjust Legal Docs Cache Timeout #9277

Merged
merged 1 commit into from Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions bedrock/legal_docs/views.py
Expand Up @@ -10,7 +10,8 @@
from bedrock.legal_docs.models import LegalDoc
from lib import l10n_utils

CACHE_TIMEOUT = getattr(settings, 'LEGAL_DOCS_CACHE_TIMEOUT', 60 * 60)

CACHE_TIMEOUT = settings.LEGAL_DOCS_CACHE_TIMEOUT


def load_legal_doc(doc_name, locale):
Expand Down Expand Up @@ -44,7 +45,7 @@ class LegalDocView(TemplateView):
* legal_doc_context_name: (default 'doc') template variable name for legal doc.

This view automatically adds the `cache_page` decorator. The default timeout
is 1 hour, configurable by setting the `LEGAL_DOCS_CACHE_TIMEOUT` setting to change
is 10 minutes, configurable by setting the `LEGAL_DOCS_CACHE_TIMEOUT` setting to change
the default for all views, or the `cache_timeout` property for an single instance.

See `bedrock/privacy/views.py` for usage examples.
Expand Down
1 change: 1 addition & 0 deletions bedrock/settings/base.py
Expand Up @@ -1364,6 +1364,7 @@ def get_app_name(hostname):
LEGAL_DOCS_REPO = config('LEGAL_DOCS_REPO', default='https://github.com/mozilla/legal-docs.git')
LEGAL_DOCS_BRANCH = config('LEGAL_DOCS_BRANCH', default='master' if DEV else 'prod')
LEGAL_DOCS_DMS_URL = config('LEGAL_DOCS_DMS_URL', default='')
LEGAL_DOCS_CACHE_TIMEOUT = config('LEGAL_DOCS_CACHE_TIMEOUT', default='60' if DEV else '600', parser=int)

MOFO_SECURITY_ADVISORIES_PATH = config('MOFO_SECURITY_ADVISORIES_PATH',
default=git_repo_path('mofo_security_advisories'))
Expand Down