mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Return result from executor. (Executor.start(...))
This commit is contained in:
parent
ddb6c81d9c
commit
f3580def03
1 changed files with 4 additions and 2 deletions
|
|
@ -75,7 +75,7 @@ def start(dispatcher, func, *, loop=None, skip_updates=None,
|
|||
executor = Executor(dispatcher, skip_updates=skip_updates, loop=loop)
|
||||
_setup_callbacks(executor, on_startup, on_shutdown)
|
||||
|
||||
executor.start(func)
|
||||
return executor.start(func)
|
||||
|
||||
|
||||
class Executor:
|
||||
|
|
@ -250,12 +250,14 @@ class Executor:
|
|||
|
||||
try:
|
||||
loop.run_until_complete(self._startup_polling())
|
||||
loop.run_until_complete(func)
|
||||
result = loop.run_until_complete(func)
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
result = None
|
||||
loop.stop()
|
||||
finally:
|
||||
loop.run_until_complete(self._shutdown_polling())
|
||||
log.warning("Goodbye!")
|
||||
return result
|
||||
|
||||
async def _skip_updates(self):
|
||||
await self.dispatcher.reset_webhook(True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue