level 4, changed to HAProxy

This commit is contained in:
2026-11-07 18:18:43 +03:00
parent 124c83e450
commit eb4e00e412
33 changed files with 3932 additions and 231 deletions
+4 -1
View File
@@ -10,7 +10,8 @@ from pydantic import BaseModel, ValidationError
from starlette.responses import Response
from .auth import BASIC_CHALLENGE, BEARER_CHALLENGE, parse_basic, parse_bearer
from .errors import invalid_request, not_found, unauthorized
from .drain import draining
from .errors import invalid_request, not_found, unauthorized, unavailable
from .pagination import encode_cursor, parse_page
from .schemas import CreateChat, CreateMessage, CreateUser
from .store import Chat, Store, User
@@ -80,6 +81,8 @@ async def liveness() -> JSONResponse:
@router.get('/health/ready')
async def readiness(store: Store = Depends(get_store)) -> JSONResponse:
if draining.is_set():
raise unavailable('Реплика завершает работу')
await store.ready()
return JSONResponse({'status': 'ok'})