lifecycle: improve redis connection debug py printing full URL
This commit is contained in:
parent
e1ef196283
commit
ef994e0084
|
@ -43,15 +43,16 @@ while True:
|
||||||
REDIS_PROTOCOL_PREFIX = "redis://"
|
REDIS_PROTOCOL_PREFIX = "redis://"
|
||||||
if CONFIG.y_bool("redis.tls", False):
|
if CONFIG.y_bool("redis.tls", False):
|
||||||
REDIS_PROTOCOL_PREFIX = "rediss://"
|
REDIS_PROTOCOL_PREFIX = "rediss://"
|
||||||
|
REDIS_URL = (
|
||||||
|
f"{REDIS_PROTOCOL_PREFIX}:"
|
||||||
|
f"{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:"
|
||||||
|
f"{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.ws_db')}"
|
||||||
|
)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
redis = Redis.from_url(
|
redis = Redis.from_url(REDIS_URL)
|
||||||
f"{REDIS_PROTOCOL_PREFIX}:"
|
|
||||||
f"{CONFIG.y('redis.password')}@{CONFIG.y('redis.host')}:"
|
|
||||||
f"{int(CONFIG.y('redis.port'))}/{CONFIG.y('redis.ws_db')}"
|
|
||||||
)
|
|
||||||
redis.ping()
|
redis.ping()
|
||||||
break
|
break
|
||||||
except RedisError as exc:
|
except RedisError as exc:
|
||||||
sleep(1)
|
sleep(1)
|
||||||
j_print(f"Redis Connection failed, retrying... ({exc})")
|
j_print(f"Redis Connection failed, retrying... ({exc})", redis_url=REDIS_URL)
|
||||||
|
|
Reference in New Issue