mirror of
https://github.com/sprockets/sprockets.http.git
synced 2024-11-14 11:19:26 +00:00
Use loop-specific create_task in Application.stop.
Calling asyncio.create_task() requires a running event loop which we cannot guarantee. The event loop is not running when stop is called in the testing.SprocketsHttpTestCase.
This commit is contained in:
parent
fd67c42a6a
commit
e81c4cefb4
2 changed files with 9 additions and 1 deletions
|
@ -3,6 +3,13 @@
|
||||||
Release History
|
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)
|
`2.1.0`_ (9 Oct 2019)
|
||||||
---------------------
|
---------------------
|
||||||
- Make shutdown timings configurable.
|
- Make shutdown timings configurable.
|
||||||
|
|
|
@ -127,7 +127,8 @@ class CallbackManager:
|
||||||
maybe_future = callback(self.tornado_application)
|
maybe_future = callback(self.tornado_application)
|
||||||
|
|
||||||
if asyncio.iscoroutine(maybe_future):
|
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):
|
if concurrent.is_future(maybe_future):
|
||||||
shutdown.add_future(maybe_future)
|
shutdown.add_future(maybe_future)
|
||||||
|
|
Loading…
Reference in a new issue