forked from mtusi2026/mtusi2026lab5
16 lines
463 B
Python
16 lines
463 B
Python
"""Простые проверки соединения с общими хранилищами."""
|
|
|
|
from redis.asyncio import Redis
|
|
from sqlalchemy import text
|
|
from sqlalchemy.ext.asyncio import AsyncEngine
|
|
|
|
|
|
async def check_database(engine: AsyncEngine) -> bool:
|
|
async with engine.connect() as connection:
|
|
await connection.execute(text("SELECT 1"))
|
|
return True
|
|
|
|
|
|
async def check_redis(client: Redis) -> bool:
|
|
return bool(await client.ping())
|