mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +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)
|
executor = Executor(dispatcher, skip_updates=skip_updates, loop=loop)
|
||||||
_setup_callbacks(executor, on_startup, on_shutdown)
|
_setup_callbacks(executor, on_startup, on_shutdown)
|
||||||
|
|
||||||
executor.start(func)
|
return executor.start(func)
|
||||||
|
|
||||||
|
|
||||||
class Executor:
|
class Executor:
|
||||||
|
|
@ -250,12 +250,14 @@ class Executor:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(self._startup_polling())
|
loop.run_until_complete(self._startup_polling())
|
||||||
loop.run_until_complete(func)
|
result = loop.run_until_complete(func)
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
result = None
|
||||||
loop.stop()
|
loop.stop()
|
||||||
finally:
|
finally:
|
||||||
loop.run_until_complete(self._shutdown_polling())
|
loop.run_until_complete(self._shutdown_polling())
|
||||||
log.warning("Goodbye!")
|
log.warning("Goodbye!")
|
||||||
|
return result
|
||||||
|
|
||||||
async def _skip_updates(self):
|
async def _skip_updates(self):
|
||||||
await self.dispatcher.reset_webhook(True)
|
await self.dispatcher.reset_webhook(True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue