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:
![98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

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