Spaces:
Running
Running
chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)
Browse filesAutomated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): szl_contracting.py
Deleted (gone from the repo + Dockerfile COPY set): (none)
Keeps the Space-built backend (serve.py + the Dockerfile-COPY'd .py
modules) identical to GitHub main so the Space never rebuilds from a
stale backend, new endpoints don't 404 there, and orphaned modules
removed from the repo don't linger in the Space tree.
- szl_contracting.py +16 -13
szl_contracting.py
CHANGED
|
@@ -697,6 +697,22 @@ def register(app, ns: str = "a11oy") -> None:
|
|
| 697 |
"checked_at": _now_iso(),
|
| 698 |
})
|
| 699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 700 |
@app.get(base + "/{area_id}/live")
|
| 701 |
async def _contracting_area_live(area_id: str): # noqa: ANN202
|
| 702 |
area = next((a for a in _AREAS if a["id"] == area_id), None)
|
|
@@ -711,19 +727,6 @@ def register(app, ns: str = "a11oy") -> None:
|
|
| 711 |
"checked_at": _now_iso(),
|
| 712 |
})
|
| 713 |
|
| 714 |
-
@app.get(base + "/sources/live")
|
| 715 |
-
async def _contracting_sources_live(): # noqa: ANN202
|
| 716 |
-
sl = _sources_live(fresh=True)
|
| 717 |
-
reach = sum(1 for s in sl.values() if (s.get("liveness") or {}).get("reachable"))
|
| 718 |
-
return JSONResponse({
|
| 719 |
-
"layer": "%s contracting source reachability" % ns,
|
| 720 |
-
"honest": _HONEST,
|
| 721 |
-
"sources": sl,
|
| 722 |
-
"sources_total": len(sl),
|
| 723 |
-
"sources_reachable": reach,
|
| 724 |
-
"checked_at": _now_iso(),
|
| 725 |
-
})
|
| 726 |
-
|
| 727 |
@app.get(base + "/refresh")
|
| 728 |
async def _contracting_refresh(): # noqa: ANN202
|
| 729 |
snap = _snapshot(fresh=False)
|
|
|
|
| 697 |
"checked_at": _now_iso(),
|
| 698 |
})
|
| 699 |
|
| 700 |
+
@app.get(base + "/sources/live")
|
| 701 |
+
async def _contracting_sources_live(): # noqa: ANN202
|
| 702 |
+
sl = _sources_live(fresh=True)
|
| 703 |
+
reach = sum(1 for s in sl.values() if (s.get("liveness") or {}).get("reachable"))
|
| 704 |
+
return JSONResponse({
|
| 705 |
+
"layer": "%s contracting source reachability" % ns,
|
| 706 |
+
"honest": _HONEST,
|
| 707 |
+
"sources": sl,
|
| 708 |
+
"sources_total": len(sl),
|
| 709 |
+
"sources_reachable": reach,
|
| 710 |
+
"checked_at": _now_iso(),
|
| 711 |
+
})
|
| 712 |
+
|
| 713 |
+
# Register the literal source-health route before the parameterized area route.
|
| 714 |
+
# Starlette resolves routes in declaration order; the reverse order makes
|
| 715 |
+
# ``sources`` look like an area ID and returns the area handler's honest 404.
|
| 716 |
@app.get(base + "/{area_id}/live")
|
| 717 |
async def _contracting_area_live(area_id: str): # noqa: ANN202
|
| 718 |
area = next((a for a in _AREAS if a["id"] == area_id), None)
|
|
|
|
| 727 |
"checked_at": _now_iso(),
|
| 728 |
})
|
| 729 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 730 |
@app.get(base + "/refresh")
|
| 731 |
async def _contracting_refresh(): # noqa: ANN202
|
| 732 |
snap = _snapshot(fresh=False)
|