Skip to content

Commit f443634

Browse files
committed
a bit more
1 parent 7539746 commit f443634

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

posthog/client.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,11 +1389,7 @@ def _initialize_flag_cache(self, cache_url):
13891389
try:
13901390
parsed = urlparse(cache_url)
13911391
scheme = parsed.scheme.lower()
1392-
1393-
# Parse query parameters
13941392
query_params = parse_qs(parsed.query)
1395-
1396-
# Extract common parameters with defaults
13971393
ttl = int(query_params.get("ttl", [300])[0])
13981394

13991395
if scheme == "memory":
@@ -1402,10 +1398,9 @@ def _initialize_flag_cache(self, cache_url):
14021398

14031399
elif scheme == "redis":
14041400
try:
1405-
# Try to import redis
1401+
# Not worth importing redis if we're not using it
14061402
import redis
14071403

1408-
# Reconstruct Redis URL without query parameters
14091404
redis_url = f"{parsed.scheme}://"
14101405
if parsed.username or parsed.password:
14111406
redis_url += f"{parsed.username or ''}:{parsed.password or ''}@"
@@ -1417,7 +1412,7 @@ def _initialize_flag_cache(self, cache_url):
14171412

14181413
client = redis.from_url(redis_url)
14191414

1420-
# Test connection
1415+
# Test connection before using it
14211416
client.ping()
14221417

14231418
return RedisFlagCache(client, default_ttl=ttl)

0 commit comments

Comments
 (0)