diff options
author | Zac Medico <zmedico@gentoo.org> | 2021-01-04 00:54:52 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2021-01-04 00:57:09 -0800 |
commit | 7efa7ecfe07737239be593b2c32e497cc1d2f154 (patch) | |
tree | 6ddb7d891668122a0dd7383c68b2a84aff39f4ff | |
parent | test_retry: use context manager to cancel pending futures (diff) | |
download | portage-7efa7ecfe07737239be593b2c32e497cc1d2f154.tar.gz portage-7efa7ecfe07737239be593b2c32e497cc1d2f154.tar.bz2 portage-7efa7ecfe07737239be593b2c32e497cc1d2f154.zip |
_Retry: Use ensure_future for self._current_task
Use ensure_future for compatibility with PEP 492 coroutines
with async and await syntax.
Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r-- | lib/portage/util/futures/retry.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/portage/util/futures/retry.py b/lib/portage/util/futures/retry.py index 4092f60d6..31cc161da 100644 --- a/lib/portage/util/futures/retry.py +++ b/lib/portage/util/futures/retry.py @@ -1,4 +1,4 @@ -# Copyright 2018 Gentoo Foundation +# Copyright 2018-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ( @@ -113,7 +113,7 @@ class _Retry: def _begin_try(self): self._tries += 1 - self._current_task = self._func() + self._current_task = asyncio.ensure_future(self._func(), loop=self._loop) self._current_task.add_done_callback(self._try_done) if self._try_timeout is not None: self._try_timeout_handle = self._loop.call_later( |