Add Audio Processor health check

This commit is contained in:
2025-07-14 00:26:42 -05:00
parent 4e1307079b
commit fc5df74f32

View File

@ -0,0 +1,29 @@
import os
import asyncio
import redis.asyncio as redis
import psycopg2
async def health_check():
"""Health check for audio processor service"""
try:
# Test Redis connection
redis_client = redis.from_url(os.getenv('REDIS_URL', 'redis://redis:6379'))
await redis_client.ping()
await redis_client.close()
# Test PostgreSQL connection
pg_conn = psycopg2.connect(os.getenv('POSTGRES_URL'))
cursor = pg_conn.cursor()
cursor.execute('SELECT 1')
cursor.close()
pg_conn.close()
print("Health check passed")
exit(0)
except Exception as e:
print(f"Health check failed: {e}")
exit(1)
if __name__ == "__main__":
asyncio.run(health_check())