Skip to content

Commit 43d79d3

Browse files
authored
[REF-3570] Remove deprecated REDIS_URL syntax (#3892)
1 parent cbe532c commit 43d79d3

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

reflex/utils/prerequisites.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -325,24 +325,19 @@ def parse_redis_url() -> str | dict | None:
325325
"""Parse the REDIS_URL in config if applicable.
326326
327327
Returns:
328-
If redis-py syntax, return the URL as it is. Otherwise, return the host/port/db as a dict.
328+
If url is non-empty, return the URL as it is.
329+
330+
Raises:
331+
ValueError: If the REDIS_URL is not a supported scheme.
329332
"""
330333
config = get_config()
331334
if not config.redis_url:
332335
return None
333-
if config.redis_url.startswith(("redis://", "rediss://", "unix://")):
334-
return config.redis_url
335-
console.deprecate(
336-
feature_name="host[:port] style redis urls",
337-
reason="redis-py url syntax is now being used",
338-
deprecation_version="0.3.6",
339-
removal_version="0.6.0",
340-
)
341-
redis_url, has_port, redis_port = config.redis_url.partition(":")
342-
if not has_port:
343-
redis_port = 6379
344-
console.info(f"Using redis at {config.redis_url}")
345-
return dict(host=redis_url, port=int(redis_port), db=0)
336+
if not config.redis_url.startswith(("redis://", "rediss://", "unix://")):
337+
raise ValueError(
338+
"REDIS_URL must start with 'redis://', 'rediss://', or 'unix://'."
339+
)
340+
return config.redis_url
346341

347342

348343
async def get_redis_status() -> bool | None:

0 commit comments

Comments
 (0)