Fix redis ssl issues

This commit is contained in:
2026-01-24 19:12:35 +01:00
parent a65789974b
commit 08f84e951a
9 changed files with 72 additions and 17 deletions

View File

@@ -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)