We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using this in fastAPI and when I use this in a route that doesn't use async keyword the context is overwitten by the call that responded faster.
async
from starlette_context import context from fastapi import Query from time import sleep ### Steps to reporoduce @app.get("/") def health(value_to_set: str = Query(), time_to_sleep: int = Query()): context.some_value = value_to_set sleep(time_to_sleep) return context.some_value
Call these in parallel with one worker
curl /?value_to_set=a&time_to_sleep=10 output: b curl /?value_to_set=b&time_to_sleep=2 output: b
Middleware is already setup as per the docs. Also, using the async keyword resolves the issue.
I am not sure if I am missing something or is this a bug. Any help on this appreciated.
The text was updated successfully, but these errors were encountered:
Great question. Sadly, I have no idea either. IIRC sync requests are run in a separate thread and I found this. encode/starlette#1258
Contributions welcome.
Sorry, something went wrong.
No branches or pull requests
I am using this in fastAPI and when I use this in a route that doesn't use
async
keyword the context is overwitten by the call that responded faster.Call these in parallel with one worker
Middleware is already setup as per the docs. Also, using the
async
keyword resolves the issue.I am not sure if I am missing something or is this a bug. Any help on this appreciated.
The text was updated successfully, but these errors were encountered: