cache 502s and 504s for requests that fetch users' sites

for #378
pull/386/head
Ryan Barrett 2023-01-24 16:29:19 -08:00
rodzic a2d9dcb4a9
commit 55d5206188
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
4 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -36,7 +36,7 @@ SUPPORTED_TYPES = (
@app.get(f'/<regex("{common.DOMAIN_RE}"):domain>')
@flask_util.cached(cache, CACHE_TIME)
@flask_util.cached(cache, CACHE_TIME, http_5xx=True)
def actor(domain):
"""Fetches a domain's h-card and converts to AS2 actor."""
_, _, actor, _ = common.actor(domain)

Wyświetl plik

@ -16,7 +16,7 @@ LINK_HEADER = '<%s>; rel="webmention"'
@app.get(r'/wm/<path:url>')
@flask_util.cached(cache, common.CACHE_TIME)
@flask_util.cached(cache, common.CACHE_TIME, http_5xx=True)
def add_wm(url=None):
"""Proxies HTTP requests and adds Link header to our webmention endpoint."""
url = urllib.parse.unquote(url)

Wyświetl plik

@ -42,7 +42,7 @@ _negotiator = ContentNegotiator(acceptable=[
@app.get(r'/r/<path:to>')
@flask_util.cached(cache, CACHE_TIME, headers=['Accept'])
@flask_util.cached(cache, CACHE_TIME, headers=['Accept'], http_5xx=True)
def redir(to):
"""301 redirect to the embedded fully qualified URL.

Wyświetl plik

@ -29,7 +29,7 @@ class Actor(flask_util.XrdOrJrd):
TODO: unify with common.actor()
"""
@flask_util.cached(cache, common.CACHE_TIME, headers=['Accept'])
@flask_util.cached(cache, common.CACHE_TIME, headers=['Accept'], http_5xx=True)
def dispatch_request(self, *args, **kwargs):
return super().dispatch_request(*args, **kwargs)