Aymeric Augustin added the comment:

For context, websockets calls `yield from self.writer.drain()` after each write 
in order to provide backpressure.

If the output buffer fills up, calling API coroutines that write to the 
websocket connection becomes slow and hopefully the backpressure will propagate 
(in a correctly implemented application).

This is a straightforward application of the only use case described in the 
documentation.

----

I would find it annoying to have to serialize calls to drain() myself. It 
doesn't feel like something the "application" should care about. (websockets is 
the application from asyncio's perspective.)

I'm wondering if it could be a problem if a bunch of corountines were waiting 
on drain() and got released simultaneously. I don't think it would be a problem 
for websockets. Since my use case seems typical, there's a good chance this 
also applies to other apps.

So I'm in favor of simply allowing an arbitrary number of coroutines to wait on 
drain() in parallel, if that's feasible.

----------
nosy: +aymeric.augustin

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29930>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to