forked from mtusi2026/mtusi2026lab5
24 lines
591 B
Python
24 lines
591 B
Python
"""Жизнь процесса и готовность критичного хранилища проверяются отдельно."""
|
|
from fastapi import APIRouter
|
|
from src.models import Health
|
|
from src.storage import storage
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get('/health/live')
|
|
def liveness():
|
|
return Health()
|
|
|
|
|
|
@router.get('/health/ready')
|
|
def readiness():
|
|
storage.ready()
|
|
from src.objects import client, BUCKET
|
|
client().list_objects_v2(Bucket=BUCKET, Prefix="staging/", MaxKeys=1)
|
|
return Health()
|
|
|
|
|
|
@router.get('/stats')
|
|
def stats():
|
|
return storage.get_stats()
|