> I suspect there is potential for a very fast async-only layer that can 
trigger the await that's hanging in a receive_async() directly from a 
send() to a related channel, rather than sticking it onto a memory location 
and waiting

Yup. Something that the gunicorn worker doesn't currently provide is 
`receive()/receive_async()` hooks, and instead current just  rely on 
`send()`ing every incoming message. For eg. HTTP the one thing that doesn't 
give you so easily is request body buffering or streaming, but you *could* 
handle that on the application side if you really wanted.

I think that the sensible next step for me will be to work towards adding 
that interface in, at which point we ought to have an implementation 
capable of running a Django service using ASGIHandler. (And yeah, I see 
that you'd be adding channel queues at that point.) ayncio.Queue is looking 
like a mightily useful bit of tooling right now.

> the design of an ASGI-direct protocol

I think the important part of this is "how does asyncio code look in the 
context of an ASGI consumer interface" rather than specifics about 
server-direct-to-consumer configurations. Not unreasonable that an "An 
asyncio ASGI app, running behind a full channel layer" could be a thing 
too, in the future.

Perhaps a good way of narrowing this down would be to consider an asyncio 
runworker: Is the application responsible for pushing coroutines onto the 
event loop (advantage: more narrowly scoped), or do you extend the ASGI 
consumer callable definition to also allow it to be a coroutine 
(advantages: more natural interface, server can manage task cancellations).

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/16f87149-6896-40a2-a1fd-028446a171a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to