Spaces:
Building
Building
Upload REBUILD.md
Browse files- REBUILD.md +1 -26
REBUILD.md
CHANGED
|
@@ -1,26 +1 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
## v126 β Fixed startup blocking / infinite rebuild loop
|
| 4 |
-
|
| 5 |
-
### Root cause
|
| 6 |
-
`load_products()` was called synchronously during startup, blocking Flask from starting
|
| 7 |
-
until all 6 product JSON files were downloaded (180s timeout Γ retries = up to 32+ min).
|
| 8 |
-
HF health check timed out β Space restarted β infinite rebuild loop.
|
| 9 |
-
|
| 10 |
-
### Fixes applied in v126
|
| 11 |
-
1. **Background thread** β `load_products()` runs in a daemon thread via `start_product_loading()`,
|
| 12 |
-
Flask starts immediately without waiting.
|
| 13 |
-
2. **Reduced timeouts** β URL timeout 180s β 30s, retries 3 β 2, max total ~2 min.
|
| 14 |
-
3. **Wrap all startup in try/except** β no crash from Zalo API calls during startup.
|
| 15 |
-
4. **Dedicated health endpoint** β `/healthz` returns 200 immediately once Flask is up.
|
| 16 |
-
5. **Startup logging** β clear loglines showing background loading started.
|
| 17 |
-
|
| 18 |
-
### Expected behavior
|
| 19 |
-
- Space starts in < 10s (health check passes)
|
| 20 |
-
- Products load in background (~30-60s for 6 files)
|
| 21 |
-
- Bot fully functional once products loaded
|
| 22 |
-
- If products fail to load, bot still serves webhooks (just no product search)
|
| 23 |
-
|
| 24 |
-
### Build info
|
| 25 |
-
- Triggered: 2026-01-06
|
| 26 |
-
- Version: v126
|
|
|
|
| 1 |
+
Restore v123 product card features - $(date)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|