Spaces:
Sleeping
Sleeping
Non-sleeping behaviour while computing
Browse files
main.py
CHANGED
|
@@ -134,7 +134,7 @@ async def _forward(path: str, method: str = "GET", json_body=None, user_token: s
|
|
| 134 |
headers["X-API-Key"] = user_token
|
| 135 |
|
| 136 |
# While waiting for upstream, call backend secure_ping every PING_UPSTREAM_INTERVAL seconds
|
| 137 |
-
ping_url = f"{UPSTREAM_URL}
|
| 138 |
ping_headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 139 |
if user_token:
|
| 140 |
ping_headers["X-API-Key"] = user_token
|
|
@@ -216,7 +216,7 @@ async def _forward_stream(path: str, files=None, data=None, user_token: str | No
|
|
| 216 |
ping_headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 217 |
if user_token:
|
| 218 |
ping_headers["X-API-Key"] = user_token
|
| 219 |
-
ping_task = _start_ping_task(f"{UPSTREAM_URL}
|
| 220 |
timeout = httpx.Timeout(UPSTREAM_TIMEOUT)
|
| 221 |
client = httpx.AsyncClient(timeout=timeout, follow_redirects=True)
|
| 222 |
|
|
@@ -288,7 +288,7 @@ async def _forward_multipart_json(path: str, files=None, data=None, user_token:
|
|
| 288 |
}
|
| 289 |
if user_token:
|
| 290 |
headers["X-API-Key"] = user_token
|
| 291 |
-
ping_url = f"{UPSTREAM_URL}
|
| 292 |
ping_headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 293 |
if user_token:
|
| 294 |
ping_headers["X-API-Key"] = user_token
|
|
|
|
| 134 |
headers["X-API-Key"] = user_token
|
| 135 |
|
| 136 |
# While waiting for upstream, call backend secure_ping every PING_UPSTREAM_INTERVAL seconds
|
| 137 |
+
ping_url = f"{UPSTREAM_URL}secure-ping/"
|
| 138 |
ping_headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 139 |
if user_token:
|
| 140 |
ping_headers["X-API-Key"] = user_token
|
|
|
|
| 216 |
ping_headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 217 |
if user_token:
|
| 218 |
ping_headers["X-API-Key"] = user_token
|
| 219 |
+
ping_task = _start_ping_task(f"{UPSTREAM_URL}secure-ping/", ping_headers)
|
| 220 |
timeout = httpx.Timeout(UPSTREAM_TIMEOUT)
|
| 221 |
client = httpx.AsyncClient(timeout=timeout, follow_redirects=True)
|
| 222 |
|
|
|
|
| 288 |
}
|
| 289 |
if user_token:
|
| 290 |
headers["X-API-Key"] = user_token
|
| 291 |
+
ping_url = f"{UPSTREAM_URL}secure-ping/"
|
| 292 |
ping_headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 293 |
if user_token:
|
| 294 |
ping_headers["X-API-Key"] = user_token
|