Fix redis ssl issues
This commit is contained in:
@@ -63,13 +63,20 @@ class SchedulerLeaderMixin:
|
||||
|
||||
Only the leader will start the scheduler.
|
||||
"""
|
||||
import ssl
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from shared.leader_election.service import LeaderElectionService
|
||||
import redis.asyncio as redis
|
||||
|
||||
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