cached-request-5
All checks were successful
deploy / deploy (push) Successful in 1m5s

This commit is contained in:
Untone 2023-12-19 19:22:26 +03:00
parent fa79164ca8
commit c90e68d3ae

View File

@ -2,7 +2,7 @@ from functools import wraps
from aiohttp import ClientSession from aiohttp import ClientSession
from starlette.exceptions import HTTPException from starlette.exceptions import HTTPException
from services.core import get_all_authors from services.core import get_all_authors, cached_authors
from settings import AUTH_URL from settings import AUTH_URL
@ -60,7 +60,7 @@ def login_required(f):
user_id = await check_auth(req) user_id = await check_auth(req)
if user_id: if user_id:
context["user_id"] = user_id context["user_id"] = user_id
authors_by_user, authors_by_id = get_all_authors() authors_by_user, authors_by_id = cached_authors
author = authors_by_user.get(user_id) author = authors_by_user.get(user_id)
if author and "id" in author: if author and "id" in author:
context["author_id"] = author["id"] context["author_id"] = author["id"]