mirror of
https://github.com/sprockets/sprockets.mixins.correlation.git
synced 2024-11-14 19:29:30 +00:00
The HandlerMixin class's prepare() function checks if super().prepare()
is an async coroutine instead of a Tornado future.
This commit is contained in:
parent
d2c0eab6a2
commit
aad5e5847f
1 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
import uuid
|
||||
|
||||
from tornado import concurrent, log
|
||||
from tornado import log
|
||||
|
||||
|
||||
class HandlerMixin(object):
|
||||
|
@ -45,9 +46,9 @@ class HandlerMixin(object):
|
|||
# Here we want to copy an incoming Correlation-ID header if
|
||||
# one exists. We also want to set it in the outgoing response
|
||||
# which the property setter does for us.
|
||||
maybe_future = super(HandlerMixin, self).prepare()
|
||||
if concurrent.is_future(maybe_future):
|
||||
await maybe_future
|
||||
maybe_coro = super(HandlerMixin, self).prepare()
|
||||
if asyncio.iscoroutine(maybe_coro):
|
||||
await maybe_coro
|
||||
|
||||
correlation_id = self.get_request_header(self.__header_name, None)
|
||||
if correlation_id is not None:
|
||||
|
|
Loading…
Reference in a new issue