Fix redis ssl issues
This commit is contained in:
@@ -58,12 +58,19 @@ class InventoryScheduler:
|
||||
|
||||
async def _start_with_leader_election(self):
|
||||
"""Start with Redis-based leader election for horizontal scaling"""
|
||||
import ssl
|
||||
import redis.asyncio as redis
|
||||
from shared.leader_election import LeaderElectionService
|
||||
|
||||
try:
|
||||
# Create Redis connection
|
||||
self._redis_client = redis.from_url(self._redis_url, decode_responses=False)
|
||||
# Create Redis connection with proper SSL handling for self-signed certificates
|
||||
connection_kwargs = {"decode_responses": False}
|
||||
|
||||
# Handle SSL/TLS for rediss:// URLs (self-signed certificates)
|
||||
if self._redis_url and self._redis_url.startswith("rediss://"):
|
||||
connection_kwargs["ssl_cert_reqs"] = ssl.CERT_NONE
|
||||
|
||||
self._redis_client = redis.from_url(self._redis_url, **connection_kwargs)
|
||||
await self._redis_client.ping()
|
||||
|
||||
# Create scheduler (but don't start it yet)
|
||||
|
||||
Reference in New Issue
Block a user