Compare commits

..

No commits in common. "c261b07ff16afa9f18b2084700d2f340c0552ae5" and "2f422edd314fe7e79874bfd70d2becdb1d80ff7d" have entirely different histories.

2 changed files with 11 additions and 21 deletions

View File

@ -8,16 +8,6 @@ from config import settings
from .ssl_transport import ssl_transport from .ssl_transport import ssl_transport
from .validators import validate_username as core_validate_username, validate_password as core_validate_password from .validators import validate_username as core_validate_username, validate_password as core_validate_password
limits = httpx.Limits(max_keepalive_connections=200, max_connections=1000)
timeout = httpx.Timeout(connect=5.0, read=10.0, write=5.0, pool=5.0)
client = httpx.AsyncClient(
transport=ssl_transport,
limits=limits,
timeout=timeout
)
auth_scheme = HTTPBearer() auth_scheme = HTTPBearer()
@ -38,16 +28,16 @@ async def _fetch_current_user(
user_agent = request.headers.get("User-Agent", "(unknown)") user_agent = request.headers.get("User-Agent", "(unknown)")
try: try:
# async with httpx.AsyncClient(transport=ssl_transport, timeout=5.0) as client: async with httpx.AsyncClient(transport=ssl_transport, timeout=5.0) as client:
response = await client.post( response = await client.post(
f"{settings.TOKEN_SERVICE}/decode", f"{settings.TOKEN_SERVICE}/decode",
json={ json={
"token": token, "token": token,
"ip": ip, "ip": ip,
"user_agent": user_agent, "user_agent": user_agent,
"require_permissions": require_permissions "require_permissions": require_permissions
}, },
) )
except httpx.RequestError as e: except httpx.RequestError as e:
print("_fetch_current_user error", e) print("_fetch_current_user error", e)
raise HTTPException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail="Token service unavailable") raise HTTPException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail="Token service unavailable")

View File

@ -1,6 +1,6 @@
[project] [project]
name = "common-lib" name = "common-lib"
version = "0.0.22" version = "0.0.21"
description = "Библиотека общих компонентов для микросервисов yobble" description = "Библиотека общих компонентов для микросервисов yobble"
authors = [{ name = "cheykrym", email = "you@example.com" }] authors = [{ name = "cheykrym", email = "you@example.com" }]
license = "MIT" license = "MIT"