lifecycle: always try custom redis URL (cherry-pick #9441) (#9458)

lifecycle: always try custom redis URL (#9441)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L <jens@goauthentik.io>
This commit is contained in:
gcp-cherry-pick-bot[bot]
2024-04-26 13:26:52 +02:00
committed by GitHub
parent f2a37e8c7c
commit 03725ae086

View File

@ -3,7 +3,6 @@
import authentik. This is done by the dockerfile."""
from sys import exit as sysexit
from time import sleep
from urllib.parse import quote_plus
from psycopg import OperationalError, connect
from redis import Redis
@ -35,7 +34,7 @@ def check_postgres():
def check_redis():
url = redis_url(CONFIG.get("redis.db"))
url = CONFIG.get("cache.url") or redis_url(CONFIG.get("redis.db"))
while True:
try:
redis = Redis.from_url(url)
@ -43,10 +42,7 @@ def check_redis():
break
except RedisError as exc:
sleep(1)
sanitized_url = url.replace(quote_plus(CONFIG.get("redis.password")), "******")
CONFIG.log(
"info", f"Redis Connection failed, retrying... ({exc})", redis_url=sanitized_url
)
CONFIG.log("info", f"Redis Connection failed, retrying... ({exc})")
CONFIG.log("info", "Redis Connection successful")