INNER CODE UNIT · Python
health_check
yaojingang/GEORank · backend/app/main.py:288
async def health_check():
"""健康检查 — 返回服务状态"""
return {"status": "ok", "service": "georank", "version": PRODUCT_VERSION}
async def _check_database() -> dict:
async with engine.connect() as conn:
await conn.execute(text("SELECT 1"))
return {"status": "ok"}
async def _check_redis() -> dict:
client = Redis.from_url(settings.REDIS_URL, encoding="utf-8", decode_responses=True)
try:
await client.ping()
finally:
await client.aclose()
return {"status": "ok"}