Download app/redis_client.py from petermutwiri/analytics-engine: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/petermutwiri/analytics-engine/resolve/main/app/redis_client.py
- Command line
-
hf download hf://spaces/petermutwiri/analytics-engine/app/redis_client.py
-
curl -L -o redis_client.py https://huggingface.co/spaces/petermutwiri/analytics-engine/resolve/main/app/redis_client.py
447 Bytes
| # app/redis_client.py – Lazy Singleton (No Startup Crash) | |
| from app.deps import get_redis | |
| # Export the singleton instance (lazy, doesn't connect until first use) | |
| redis = get_redis() | |
| # ✅ REMOVE: Don't ping on import - causes startup race condition | |
| # try: | |
| # redis.ping() | |
| # print("✅ Redis bridge connected") | |
| # except Exception as e: | |
| # print(f"❌ Redis connection failed: {e}") | |
| # raise RuntimeError(f"Redis not available: {e}") |