MukeshKapoor25 commited on
Commit
334a825
·
1 Parent(s): 72e63d6

fix(redis): Update Redis client initialization to validate REDIS_URL scheme and log warnings for invalid formats

Browse files
Files changed (2) hide show
  1. README.md +3 -4
  2. app/cache.py +12 -9
README.md CHANGED
@@ -9,12 +9,11 @@ pinned: false
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
11
 
 
12
 
13
- # Supply Chain Management (SCM) Microservice
14
 
15
- A comprehensive FastAPI-based microservice for managing merchants, employees, and sales operations within the Insightfy Bloom platform. This service provides robust APIs for organizational hierarchy management, employee tracking, and sales order processing.
16
-
17
- # Cuatrolabs App Microservice - Project Summary
18
 
19
  ## ✅ Project Setup Complete
20
 
 
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
11
 
12
+ # E-Commerce Microservice
13
 
14
+ A comprehensive FastAPI-based microservice for managing orders, carts, products, appointments, and merchant discovery within the Cuatrolabs platform. This service provides robust APIs for e-commerce operations.
15
 
16
+ # Cuatrolabs E-Commerce Microservice - Project Summary
 
 
17
 
18
  ## ✅ Project Setup Complete
19
 
app/cache.py CHANGED
@@ -30,15 +30,18 @@ def _redis_from_settings() -> redis.Redis:
30
  """Create Redis client from settings using insightfy patterns."""
31
  cache_url = (CACHE_URL or "").strip()
32
  if cache_url:
33
- if not cache_url.startswith(("redis://", "rediss://", "unix://")):
34
- raise ValueError("REDIS_URL must start with redis://, rediss://, or unix://")
35
- return redis.from_url(
36
- cache_url,
37
- decode_responses=True,
38
- socket_timeout=5,
39
- socket_connect_timeout=5,
40
- retry_on_timeout=True,
41
- health_check_interval=30,
 
 
 
42
  )
43
 
44
  try:
 
30
  """Create Redis client from settings using insightfy patterns."""
31
  cache_url = (CACHE_URL or "").strip()
32
  if cache_url:
33
+ if cache_url.startswith(("redis://", "rediss://", "unix://")):
34
+ return redis.from_url(
35
+ cache_url,
36
+ decode_responses=True,
37
+ socket_timeout=5,
38
+ socket_connect_timeout=5,
39
+ retry_on_timeout=True,
40
+ health_check_interval=30,
41
+ )
42
+ logger.warning(
43
+ "Invalid REDIS_URL scheme; falling back to REDIS_HOST/REDIS_PORT",
44
+ extra={"redis_url": cache_url},
45
  )
46
 
47
  try: