diff options
author | Zac Medico <zmedico@gentoo.org> | 2018-04-26 01:29:04 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2018-04-26 01:43:53 -0700 |
commit | 391daef6fce981acd5a01e41a0f7238044c48877 (patch) | |
tree | 9144ad0c106827501c99737404e327a33f122bc2 | |
parent | CompositeTask._cancel(): use _async_wait() (bug 591760) (diff) | |
download | portage-391daef6fce981acd5a01e41a0f7238044c48877.tar.gz portage-391daef6fce981acd5a01e41a0f7238044c48877.tar.bz2 portage-391daef6fce981acd5a01e41a0f7238044c48877.zip |
MirrorDistTask._term_callback(): use _async_wait() (bug 591760)
Use _async_wait() to avoid event loop recursion, but don't call
it prematurely, since since that could trigger event loop recursion
if the current (cancelled) task's exit callback does not set the
returncode first.
Bug: https://bugs.gentoo.org/591760
-rw-r--r-- | pym/portage/_emirrordist/MirrorDistTask.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/portage/_emirrordist/MirrorDistTask.py b/pym/portage/_emirrordist/MirrorDistTask.py index a34f2c061..48d0f7cf2 100644 --- a/pym/portage/_emirrordist/MirrorDistTask.py +++ b/pym/portage/_emirrordist/MirrorDistTask.py @@ -231,7 +231,15 @@ class MirrorDistTask(CompositeTask): if self._fetch_iterator is not None: self._fetch_iterator.terminate() self.cancel() - self.wait() + if self.returncode is None: + # In this case, the exit callback for self._current_task will + # trigger notification of exit listeners. Don't call _async_wait() + # yet, since that could trigger event loop recursion if the + # current (cancelled) task's exit callback does not set the + # returncode first. + pass + else: + self._async_wait() def _wait(self): CompositeTask._wait(self) |