mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
perf(aurweb): create a context with what is required
The pkgbase/util.py `make_context` helper does a lot of unrelated expensive queries which are not required for any of the templates. Only the 404 template shows git_clone_uri_* and pkgbase.
This commit is contained in:
parent
9b12eaf2b9
commit
6c6ecd3971
1 changed files with 3 additions and 2 deletions
|
@ -22,7 +22,6 @@ from starlette.middleware.sessions import SessionMiddleware
|
||||||
import aurweb.captcha # noqa: F401
|
import aurweb.captcha # noqa: F401
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
import aurweb.filters # noqa: F401
|
import aurweb.filters # noqa: F401
|
||||||
import aurweb.pkgbase.util as pkgbaseutil
|
|
||||||
from aurweb import aur_logging, prometheus, util
|
from aurweb import aur_logging, prometheus, util
|
||||||
from aurweb.aur_redis import redis_connection
|
from aurweb.aur_redis import redis_connection
|
||||||
from aurweb.auth import BasicAuthBackend
|
from aurweb.auth import BasicAuthBackend
|
||||||
|
@ -215,7 +214,9 @@ async def http_exception_handler(request: Request, exc: HTTPException) -> Respon
|
||||||
if matches and len(tokens) == 2:
|
if matches and len(tokens) == 2:
|
||||||
try:
|
try:
|
||||||
pkgbase = get_pkg_or_base(matches.group(1))
|
pkgbase = get_pkg_or_base(matches.group(1))
|
||||||
context = pkgbaseutil.make_context(request, pkgbase)
|
context["pkgbase"] = pkgbase
|
||||||
|
context["git_clone_uri_anon"] = aurweb.config.get("options", "git_clone_uri_anon")
|
||||||
|
context["git_clone_uri_priv"] = aurweb.config.get("options", "git_clone_uri_priv")
|
||||||
except HTTPException:
|
except HTTPException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue