зеркало из https://github.com/mozilla/kitsune.git
cache webpack_static helper to reduce json loading/parsing
https://github.com/mozilla/sumo-project/issues/874
This commit is contained in:
Родитель
a582a1a9cd
Коммит
b44a688d87
|
@ -413,6 +413,10 @@ STATICFILES_FINDERS = (
|
|||
|
||||
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
|
||||
|
||||
WEBPACK_LRU_CACHE = 128
|
||||
if DEV or TEST:
|
||||
WEBPACK_LRU_CACHE = 0
|
||||
|
||||
# Paths that don't require a locale prefix.
|
||||
SUPPORTED_NONLOCALES = (
|
||||
"1",
|
||||
|
|
|
@ -3,6 +3,7 @@ import re
|
|||
import sys
|
||||
from contextlib import contextmanager
|
||||
from datetime import datetime
|
||||
from functools import lru_cache
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
|
@ -353,6 +354,7 @@ def check_for_spam_content(data):
|
|||
return is_toll_free or is_nanp_number or has_links
|
||||
|
||||
|
||||
@lru_cache(maxsize=settings.WEBPACK_LRU_CACHE)
|
||||
def webpack_static(source_path):
|
||||
"""
|
||||
Get the URL for an asset processed by webpack.
|
||||
|
|
Загрузка…
Ссылка в новой задаче