mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Fixed slow-responses into webhook (via simple request)
This commit is contained in:
parent
3076173384
commit
272322ab38
2 changed files with 7 additions and 2 deletions
|
|
@ -87,8 +87,11 @@ class WebhookRequestHandler(web.View):
|
||||||
:return: :class:`aiogram.Dispatcher`
|
:return: :class:`aiogram.Dispatcher`
|
||||||
"""
|
"""
|
||||||
dp = self.request.app[BOT_DISPATCHER_KEY]
|
dp = self.request.app[BOT_DISPATCHER_KEY]
|
||||||
context.set_value('dispatcher', dp)
|
try:
|
||||||
context.set_value('bot', dp.bot)
|
context.set_value('dispatcher', dp)
|
||||||
|
context.set_value('bot', dp.bot)
|
||||||
|
except RuntimeError:
|
||||||
|
pass
|
||||||
return dp
|
return dp
|
||||||
|
|
||||||
async def parse_update(self, bot):
|
async def parse_update(self, bot):
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ def get_current_state() -> typing.Dict:
|
||||||
:rtype: :obj:`dict`
|
:rtype: :obj:`dict`
|
||||||
"""
|
"""
|
||||||
task = asyncio.Task.current_task()
|
task = asyncio.Task.current_task()
|
||||||
|
if task is None:
|
||||||
|
raise RuntimeError('Can be used only in Task context.')
|
||||||
context_ = getattr(task, 'context', None)
|
context_ = getattr(task, 'context', None)
|
||||||
if context_ is None:
|
if context_ is None:
|
||||||
context_ = task.context = {}
|
context_ = task.context = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue