Fixed slow-responses into webhook (via simple request)

This commit is contained in:
Alex Root Junior 2018-05-11 02:24:57 +03:00
parent 3076173384
commit 272322ab38
2 changed files with 7 additions and 2 deletions

View file

@ -46,6 +46,8 @@ def get_current_state() -> typing.Dict:
:rtype: :obj:`dict`
"""
task = asyncio.Task.current_task()
if task is None:
raise RuntimeError('Can be used only in Task context.')
context_ = getattr(task, 'context', None)
if context_ is None:
context_ = task.context = {}