Skip to content

Commit

Permalink
improve termination when using uvloop
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Oct 19, 2017
1 parent 14d3aa2 commit 6bbf5d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ History
0.6.2 (2017-10-19)
------------------
* fix loop pickling regression in #150 #154
* cleanup termination with uvloop #154

0.6.1 (2017-10-19)
------------------
Expand Down
9 changes: 3 additions & 6 deletions aiohttp_devtools/runserver/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ def run_app(app, port, loop):
server.close()
loop.run_until_complete(server.wait_closed())
loop.run_until_complete(app.shutdown())
loop.run_until_complete(app.cleanup())
with contextlib.suppress(asyncio.TimeoutError):
loop.run_until_complete(handler.shutdown(2))
loop.stop()
loop.run_forever()
loop.close()
with contextlib.suppress(asyncio.TimeoutError, KeyboardInterrupt):
loop.run_until_complete(handler.shutdown(0.1))
loop.run_until_complete(app.cleanup())


def runserver(*, loop: asyncio.AbstractEventLoop=None, **config_kwargs):
Expand Down
5 changes: 2 additions & 3 deletions aiohttp_devtools/runserver/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ def serve_main_app(config: Config, tty_path: Optional[str], loop: asyncio.Abstra
server.close()
loop.run_until_complete(server.wait_closed())
loop.run_until_complete(app.shutdown())
with contextlib.suppress(asyncio.TimeoutError):
with contextlib.suppress(asyncio.TimeoutError, KeyboardInterrupt):
loop.run_until_complete(handler.shutdown(0.1))
loop.run_until_complete(app.cleanup())
loop.close()
loop.run_until_complete(app.cleanup())


WS = 'websockets'
Expand Down

0 comments on commit 6bbf5d3

Please sign in to comment.