mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
More truthful description of the method (Executor.start(...))
This commit is contained in:
parent
cd320b3cf5
commit
2010922809
1 changed files with 12 additions and 10 deletions
|
|
@ -59,14 +59,14 @@ def start_webhook(dispatcher, webhook_path, *, loop=None, skip_updates=None,
|
||||||
executor.start_webhook(webhook_path, **kwargs)
|
executor.start_webhook(webhook_path, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def start(dispatcher, func, *, loop=None, skip_updates=None,
|
def start(dispatcher, future, *, loop=None, skip_updates=None,
|
||||||
on_startup=None, on_shutdown=None):
|
on_startup=None, on_shutdown=None):
|
||||||
"""
|
"""
|
||||||
Execute function
|
Execute Future.
|
||||||
|
|
||||||
:param dispatcher:
|
:param dispatcher: instance of Dispatcher
|
||||||
:param func:
|
:param future: future
|
||||||
:param loop:
|
:param loop: instance of AbstractEventLoop
|
||||||
:param skip_updates:
|
:param skip_updates:
|
||||||
:param on_startup:
|
:param on_startup:
|
||||||
:param on_shutdown:
|
:param on_shutdown:
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
return executor.start(func)
|
return executor.start(future)
|
||||||
|
|
||||||
|
|
||||||
class Executor:
|
class Executor:
|
||||||
|
|
@ -237,11 +237,13 @@ class Executor:
|
||||||
loop.run_until_complete(self._shutdown_polling())
|
loop.run_until_complete(self._shutdown_polling())
|
||||||
log.warning("Goodbye!")
|
log.warning("Goodbye!")
|
||||||
|
|
||||||
def start(self, func):
|
def start(self, future):
|
||||||
"""
|
"""
|
||||||
Execute function
|
Execute Future.
|
||||||
|
|
||||||
:param func:
|
Return the Future's result, or raise its exception.
|
||||||
|
|
||||||
|
:param future:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
self._check_frozen()
|
self._check_frozen()
|
||||||
|
|
@ -250,7 +252,7 @@ class Executor:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(self._startup_polling())
|
loop.run_until_complete(self._startup_polling())
|
||||||
result = loop.run_until_complete(func)
|
result = loop.run_until_complete(future)
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
result = None
|
result = None
|
||||||
loop.stop()
|
loop.stop()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue