Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,9 +16,9 @@ import hashlib
|
|
| 16 |
# Backend processor connection
|
| 17 |
BACKEND_URL = "https://turtle170-ZeroEngine-Backend.hf.space"
|
| 18 |
BACKEND_FALLBACK_URL = "turtle170/ZeroEngine-Backend" # Fallback to repo ID
|
| 19 |
-
CONNECTION_TIMEOUT =
|
| 20 |
MAX_RETRIES = 3
|
| 21 |
-
RETRY_DELAY =
|
| 22 |
|
| 23 |
class BackendProcessor:
|
| 24 |
"""Enhanced client for ZeroEngine-Backend processing with retry logic and health checks"""
|
|
@@ -81,7 +81,11 @@ class BackendProcessor:
|
|
| 81 |
return True
|
| 82 |
|
| 83 |
except Exception as e:
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
self.connected = False
|
| 86 |
|
| 87 |
if attempt < MAX_RETRIES - 1:
|
|
|
|
| 16 |
# Backend processor connection
|
| 17 |
BACKEND_URL = "https://turtle170-ZeroEngine-Backend.hf.space"
|
| 18 |
BACKEND_FALLBACK_URL = "turtle170/ZeroEngine-Backend" # Fallback to repo ID
|
| 19 |
+
CONNECTION_TIMEOUT = 60 # seconds
|
| 20 |
MAX_RETRIES = 3
|
| 21 |
+
RETRY_DELAY = 5 # seconds
|
| 22 |
|
| 23 |
class BackendProcessor:
|
| 24 |
"""Enhanced client for ZeroEngine-Backend processing with retry logic and health checks"""
|
|
|
|
| 81 |
return True
|
| 82 |
|
| 83 |
except Exception as e:
|
| 84 |
+
error_type = type(e).__name__
|
| 85 |
+
error_msg = str(e)
|
| 86 |
+
logger.warning(f"[BACKEND] Connection failed to {url} (attempt {attempt+1}): {error_type}: {error_msg}")
|
| 87 |
+
logger.warning(f"[BACKEND] Error details: {repr(e)}")
|
| 88 |
+
logger.warning(f"[BACKEND] Connection timeout: {CONNECTION_TIMEOUT}s, retry delay: {RETRY_DELAY}s")
|
| 89 |
self.connected = False
|
| 90 |
|
| 91 |
if attempt < MAX_RETRIES - 1:
|