Skip to content

Commit d777b8d

Browse files
committed
Convert debug_graph_lru_cache to def; add async def inventory to decisions.md
1 parent b6a1dd5 commit d777b8d

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

backend/app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ def get_group(
18311831

18321832

18331833
@app.get("/_debug/cache")
1834-
async def debug_graph_lru_cache() -> dict[str, Any]:
1834+
def debug_graph_lru_cache() -> dict[str, Any]:
18351835
"""
18361836
GerryDB graph LRU cache stats (hits/misses/size).
18371837

docs/decisions.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ when threads exceed pool size. Measured: under a 30-second PostGIS geometry diss
2727
`dev`, a single fast probe (`/db_is_alive`) stalled for 63 seconds — event loop fully
2828
blocked. The same test on this branch showed 3–11 ms throughout.
2929

30+
**Endpoints that are legitimately `async def`** (as of this PR):
31+
32+
| Endpoint | Awaitable |
33+
|---|---|
34+
| `POST /session` | `verify_session_turnstile` — httpx Turnstile call |
35+
| `PUT /api/assignments` | `request.body()` — streaming raw msgpack body |
36+
| `POST /api/commenter`, `/comment`, `/tag`, `/submit-comment` | `turnstile.verify_turnstile` — httpx Turnstile call |
37+
38+
All other route handlers are `def`. Non-route `async def` (middleware, lifespan,
39+
exception handlers) are required to be async by FastAPI/Starlette's own API and are
40+
not in scope of this rule.
41+
3042
**A widely circulated "FastAPI expert" skill** asserts "MUST NOT: Use synchronous
3143
database operations" and "Use async/await for all I/O operations." That rule is
3244
correct at the library-call level (don't call `requests.get` inside `async def`) but

0 commit comments

Comments
 (0)