Spaces:
Sleeping
Sleeping
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- README.md +3 -4
- 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 |
-
|
| 14 |
|
| 15 |
-
|
| 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
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
| 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:
|