-
-
Notifications
You must be signed in to change notification settings - Fork 833
New issue
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
Make ASGI dispatcher asyncio-agnostic #247
Comments
I'd probably suggest "to be used by the BodyIterator" rather than "to be used instead of BodyIterator". That'd likely be a smaller change footprint. (Tho we can thrash that level of detail out against the pull request once we're there)
I think the proposed API there is decent, yup. To an extent it doesn't matter too much so long as we have something reasonable here, that we can rejig later if we wanted. |
A thought here: we could probably forgo needing to implement a |
Going to see if I can take a crack at dropping the |
I’ll update the issue description soon taking into account the simplified concurrency in the ASGI dispatcher. 👍 |
Would this affect #52 at all? Or possibly the design of it? |
Yeah it'll tie in. We'll want to get this side of things all nice and clean and sorted first, then we'll be able to take a proper look at #52 again. |
I thought as much. Started on it but got sidetracked. I'll wait on this to settle first though, as it's more important for sure. |
Note: this issue breaks apart steps originally taken in #217.
The ASGI dispatcher currently relies on asyncio-specific APIs to perform various operations, which is a blocker towards supporting alternative concurrency backends.
We want to make sure all of the I/O inside
ASGIDispatch
goes through the backend instead.This will need the following, most of which can be tackled in independant PRs:
Add BaseQueue interface #257 Hard-code
self.backend = AsyncioBackend()
onASGIDispatch
to be able to iteratively defer asyncio-specific APIs to the backend.Add BaseQueue interface #257 Introduce a queue-like interface:
along with a
.create_queue()
method onConcurrencyBackend
, to be used instead of/within theBodyIterator
.(For trio we'll probably need to add a
.close()
method as well, but that can be confirmed and tackled in due time.)BaseEvent
interface:along with a
.create_event()
method onConcurrencyBackend
to abstractasyncio.Event()
.Remove usage of loop.create_task in ASGIDispatch #261 Remove usage of loop.create_task() via the background manager interface.
Lastly, turn the hard-coded
backend
into a parameter. Make sure it is optional and we useAsyncioBackend
as a default.The text was updated successfully, but these errors were encountered: