Merge pull request #35 from dave-shawley/fix-testing

Use loop-specific create_task in Application.stop.
This commit is contained in:
cknave 2020-02-19 09:14:31 -05:00 committed by GitHub
commit 07e6f0975a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -3,6 +3,13 @@
Release History
===============
`Next Release`_
---------------
- :meth:`sprockets.http.app.CallbackManager.stop` no longer requires the
event loop to be running (fixes `#34`_)
.. _#34: https://github.com/sprockets/sprockets.http/issues/34
`2.1.0`_ (9 Oct 2019)
---------------------
- Make shutdown timings configurable.

View file

@ -127,7 +127,8 @@ class CallbackManager:
maybe_future = callback(self.tornado_application)
if asyncio.iscoroutine(maybe_future):
maybe_future = asyncio.create_task(maybe_future)
maybe_future = io_loop.asyncio_loop.create_task(
maybe_future)
if concurrent.is_future(maybe_future):
shutdown.add_future(maybe_future)