[tasks] Keep retrying before gracefully exiting.
This commit is contained in:
parent
4eead39b3c
commit
49a7e58d17
@ -74,8 +74,6 @@ class Loop:
|
|||||||
except self._valid_exception as exc:
|
except self._valid_exception as exc:
|
||||||
if not self.reconnect:
|
if not self.reconnect:
|
||||||
raise
|
raise
|
||||||
if self._stop_next_iteration:
|
|
||||||
return
|
|
||||||
await asyncio.sleep(backoff.delay())
|
await asyncio.sleep(backoff.delay())
|
||||||
else:
|
else:
|
||||||
if self._stop_next_iteration:
|
if self._stop_next_iteration:
|
||||||
@ -141,6 +139,16 @@ class Loop:
|
|||||||
Unlike :meth:`cancel`\, this allows the task to finish its
|
Unlike :meth:`cancel`\, this allows the task to finish its
|
||||||
current iteration before gracefully exiting.
|
current iteration before gracefully exiting.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If the internal function raises an error that can be
|
||||||
|
handled before finishing then it will retry until
|
||||||
|
it succeeds.
|
||||||
|
|
||||||
|
If this is undesirable, either remove the error handling
|
||||||
|
before stopping via :meth:`clear_exception_types` or
|
||||||
|
use :meth:`cancel` instead.
|
||||||
|
|
||||||
.. versionadded:: 1.2
|
.. versionadded:: 1.2
|
||||||
"""
|
"""
|
||||||
if self._task and not self._task.done():
|
if self._task and not self._task.done():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user