Fix redis ssl issues 2
This commit is contained in:
@@ -49,17 +49,13 @@ class UsageForecastResponse(BaseModel):
|
||||
|
||||
async def get_redis_client() -> redis.Redis:
|
||||
"""Get Redis client for usage tracking"""
|
||||
import ssl
|
||||
from shared.redis_utils import RedisConnectionManager
|
||||
|
||||
# Handle SSL/TLS for self-signed certificates
|
||||
connection_kwargs = {
|
||||
"encoding": "utf-8",
|
||||
"decode_responses": True
|
||||
}
|
||||
if settings.REDIS_URL and settings.REDIS_URL.startswith("rediss://"):
|
||||
connection_kwargs["ssl_cert_reqs"] = ssl.CERT_NONE
|
||||
|
||||
return redis.from_url(settings.REDIS_URL, **connection_kwargs)
|
||||
# Create Redis connection using shared manager (handles SSL, pooling, health checks)
|
||||
manager = await RedisConnectionManager.create(
|
||||
settings.REDIS_URL, decode_responses=True
|
||||
)
|
||||
return manager.get_client()
|
||||
|
||||
|
||||
async def get_usage_history(
|
||||
|
||||
Reference in New Issue
Block a user