Add in-memory cache around linguist data
Mostly useful for local development, but should help a little in production too
This commit is contained in:
parent
7bf9956627
commit
530503d769
2 changed files with 3 additions and 1 deletions
|
@ -5,7 +5,7 @@ accesslog = "-"
|
|||
disable_redirect_access_to_syslog = True
|
||||
preload_app = True
|
||||
bind = "0.0.0.0:8080"
|
||||
max_requests = 800
|
||||
max_requests = 1200
|
||||
max_requests_jitter = 50
|
||||
forwarded_allow_ips = "*"
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from functools import cache
|
||||
from importlib.metadata import version
|
||||
|
||||
import requests
|
||||
|
@ -10,6 +11,7 @@ PYGMENTS_VERSION_SLUG = PYGMENTS_VERSION.replace(".", "-")
|
|||
LINGUIST_DATA_URL = "https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml"
|
||||
|
||||
|
||||
@cache
|
||||
@django_cache_decorator(time=21600)
|
||||
def get_linguist_colours() -> dict[str, str]:
|
||||
response = requests.get(LINGUIST_DATA_URL)
|
||||
|
|
Loading…
Reference in a new issue