[docs] [issue28212] Closing server in asyncio is not efficient

Константин Волков report at bugs.python.org
Tue Sep 20 16:23:03 EDT 2016


Константин Волков added the comment:

Seems that its not so hard - in loop.remove_reader add

self._ready.append(reader)

after reader.cancel()

May be its needed to check that its not already there, but I cant imagine
how it can be.

2016-09-20 23:16 GMT+03:00 Andrew Svetlov <report at bugs.python.org>:

>
> Andrew Svetlov added the comment:
>
> It's a known annoying issue.
> Honestly I don't know how to fix it properly.
> `transport.close()` is affected also because `protocol.connection_lost()`
> is called on next loop iteration only.
>
> Adding a small `asyncio.sleep()` between finishing all worn and loop
> closing solves the problem for me but the solution is not obvious for
> newbies.
>
> ----------
> nosy: +asvetlov
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue28212>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28212>
_______________________________________


More information about the docs mailing list