mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge 1961ce5b46 into 1281bf551a
This commit is contained in:
commit
a38773f3ea
2 changed files with 7 additions and 11 deletions
1
CHANGES/1298.bugfix
Normal file
1
CHANGES/1298.bugfix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Update workflow data on start
|
||||
|
|
@ -514,16 +514,11 @@ class Dispatcher(Router):
|
|||
signal.SIGINT, self._signal_stop_polling, signal.SIGINT
|
||||
)
|
||||
|
||||
workflow_data = {
|
||||
"dispatcher": self,
|
||||
"bots": bots,
|
||||
**self.workflow_data,
|
||||
**kwargs,
|
||||
}
|
||||
if "bot" in workflow_data:
|
||||
workflow_data.pop("bot")
|
||||
self.workflow_data.update({"dispatcher": self, "bots": bots, **kwargs})
|
||||
if "bot" in self.workflow_data:
|
||||
self.workflow_data.pop("bot")
|
||||
|
||||
await self.emit_startup(bot=bots[-1], **workflow_data)
|
||||
await self.emit_startup(bot=bots[-1], **self.workflow_data)
|
||||
loggers.dispatcher.info("Start polling")
|
||||
try:
|
||||
tasks: List[asyncio.Task[Any]] = [
|
||||
|
|
@ -534,7 +529,7 @@ class Dispatcher(Router):
|
|||
polling_timeout=polling_timeout,
|
||||
backoff_config=backoff_config,
|
||||
allowed_updates=allowed_updates,
|
||||
**workflow_data,
|
||||
**self.workflow_data,
|
||||
)
|
||||
)
|
||||
for bot in bots
|
||||
|
|
@ -553,7 +548,7 @@ class Dispatcher(Router):
|
|||
finally:
|
||||
loggers.dispatcher.info("Polling stopped")
|
||||
try:
|
||||
await self.emit_shutdown(bot=bots[-1], **workflow_data)
|
||||
await self.emit_shutdown(bot=bots[-1], **self.workflow_data)
|
||||
finally:
|
||||
if close_bot_session:
|
||||
await asyncio.gather(*(bot.session.close() for bot in bots))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue