Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /li-boxuan_OpenDevin /enterprise /server /routes /readiness.py
| from fastapi import APIRouter, HTTPException, status | |
| from sqlalchemy.sql import text | |
| from storage.database import session_maker | |
| from storage.redis import create_redis_client | |
| from openhands.core.logger import openhands_logger as logger | |
| readiness_router = APIRouter() | |
| def is_ready(): | |
| # Check database connection | |
| try: | |
| with session_maker() as session: | |
| session.execute(text('SELECT 1')) | |
| except Exception as e: | |
| logger.error(f'Database check failed: {str(e)}') | |
| raise HTTPException( | |
| status_code=status.HTTP_503_SERVICE_UNAVAILABLE, | |
| detail=f'Database is not accessible: {str(e)}', | |
| ) | |
| # Check Redis connection | |
| try: | |
| redis_client = create_redis_client() | |
| redis_client.ping() | |
| except Exception as e: | |
| logger.error(f'Redis check failed: {str(e)}') | |
| raise HTTPException( | |
| status_code=status.HTTP_503_SERVICE_UNAVAILABLE, | |
| detail=f'Redis cache is not accessible: {str(e)}', | |
| ) | |
| return 'OK' | |
Xet Storage Details
- Size:
- 1.06 kB
- Xet hash:
- e29f11998444fa324ad68b5dc9e9e9e62a1dc42474ef4efe4595a754de32ce25
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.