mirror of
https://github.com/sprockets/sprockets.mixins.correlation.git
synced 2024-11-23 11:19:53 +00:00
Merge pull request #9 from noone234/fix-async-coro
Fix async coroutine execution in HandlerMixin.prepare()
This commit is contained in:
commit
c48b1c37d0
4 changed files with 13 additions and 6 deletions
|
@ -1,6 +1,11 @@
|
||||||
Version History
|
Version History
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
`3.0.0`_ (18-Dec-2019)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
- Dropped support for Tornado 4
|
||||||
|
- Fixed support for async prepare in superclasses of ``HandlerMixin``
|
||||||
|
|
||||||
`2.0.1`_ (18-Mar-2019)
|
`2.0.1`_ (18-Mar-2019)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
- Add support for Tornado 6
|
- Add support for Tornado 6
|
||||||
|
@ -21,6 +26,7 @@ Version History
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
- Adds ``sprockets.mixins.correlation.HandlerMixin``
|
- Adds ``sprockets.mixins.correlation.HandlerMixin``
|
||||||
|
|
||||||
|
.. _`3.0.0`: https://github.com/sprockets/sprockets.mixins.correlation/compare/3.0.0...2.0.1
|
||||||
.. _`2.0.1`: https://github.com/sprockets/sprockets.mixins.correlation/compare/2.0.0...2.0.1
|
.. _`2.0.1`: https://github.com/sprockets/sprockets.mixins.correlation/compare/2.0.0...2.0.1
|
||||||
.. _`2.0.0`: https://github.com/sprockets/sprockets.mixins.correlation/compare/1.0.2...2.0.0
|
.. _`2.0.0`: https://github.com/sprockets/sprockets.mixins.correlation/compare/1.0.2...2.0.0
|
||||||
.. _`1.0.2`: https://github.com/sprockets/sprockets.mixins.correlation/compare/1.0.1...1.0.2
|
.. _`1.0.2`: https://github.com/sprockets/sprockets.mixins.correlation/compare/1.0.1...1.0.2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
tornado>=4.3,<7
|
tornado>=5,<7
|
||||||
|
|
|
@ -7,5 +7,5 @@ except ImportError:
|
||||||
raise ImportError
|
raise ImportError
|
||||||
|
|
||||||
|
|
||||||
version_info = (2, 0, 1)
|
version_info = (3, 0, 0)
|
||||||
__version__ = '.'.join(str(v) for v in version_info[:3])
|
__version__ = '.'.join(str(v) for v in version_info[:3])
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import asyncio
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from tornado import concurrent, log
|
from tornado import log
|
||||||
|
|
||||||
|
|
||||||
class HandlerMixin(object):
|
class HandlerMixin(object):
|
||||||
|
@ -45,9 +46,9 @@ class HandlerMixin(object):
|
||||||
# Here we want to copy an incoming Correlation-ID header if
|
# Here we want to copy an incoming Correlation-ID header if
|
||||||
# one exists. We also want to set it in the outgoing response
|
# one exists. We also want to set it in the outgoing response
|
||||||
# which the property setter does for us.
|
# which the property setter does for us.
|
||||||
maybe_future = super(HandlerMixin, self).prepare()
|
maybe_coro = super(HandlerMixin, self).prepare()
|
||||||
if concurrent.is_future(maybe_future):
|
if asyncio.iscoroutine(maybe_coro):
|
||||||
await maybe_future
|
await maybe_coro
|
||||||
|
|
||||||
correlation_id = self.get_request_header(self.__header_name, None)
|
correlation_id = self.get_request_header(self.__header_name, None)
|
||||||
if correlation_id is not None:
|
if correlation_id is not None:
|
||||||
|
|
Loading…
Reference in a new issue