Skip to content

Commit d684dc9

Browse files
fix: use sync route handlers to avoid blocking the event loop
Convert home() and protected_route() from async def to def so FastAPI runs them in a threadpool, preventing synchronous OAuth calls from blocking the async event loop. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0df911f commit d684dc9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kinde_fastapi/examples/example_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
# Example home route
6666
@app.get("/", response_class=HTMLResponse)
67-
async def home():
67+
def home():
6868
"""
6969
Home page that shows different content based on authentication status.
7070
"""
@@ -119,7 +119,7 @@ async def home():
119119

120120

121121
@app.get("/protected")
122-
async def protected_route():
122+
def protected_route():
123123
"""
124124
Example of a protected route that requires authentication.
125125
Redirects to login if not authenticated.

0 commit comments

Comments
 (0)