Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/_emirrordist/
Date: Thu, 26 Apr 2018 08:46:11
Message-Id: 1524732233.391daef6fce981acd5a01e41a0f7238044c48877.zmedico@gentoo
1 commit: 391daef6fce981acd5a01e41a0f7238044c48877
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 26 08:29:04 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 26 08:43:53 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=391daef6
7
8 MirrorDistTask._term_callback(): use _async_wait() (bug 591760)
9
10 Use _async_wait() to avoid event loop recursion, but don't call
11 it prematurely, since since that could trigger event loop recursion
12 if the current (cancelled) task's exit callback does not set the
13 returncode first.
14
15 Bug: https://bugs.gentoo.org/591760
16
17 pym/portage/_emirrordist/MirrorDistTask.py | 10 +++++++++-
18 1 file changed, 9 insertions(+), 1 deletion(-)
19
20 diff --git a/pym/portage/_emirrordist/MirrorDistTask.py b/pym/portage/_emirrordist/MirrorDistTask.py
21 index a34f2c061..48d0f7cf2 100644
22 --- a/pym/portage/_emirrordist/MirrorDistTask.py
23 +++ b/pym/portage/_emirrordist/MirrorDistTask.py
24 @@ -231,7 +231,15 @@ class MirrorDistTask(CompositeTask):
25 if self._fetch_iterator is not None:
26 self._fetch_iterator.terminate()
27 self.cancel()
28 - self.wait()
29 + if self.returncode is None:
30 + # In this case, the exit callback for self._current_task will
31 + # trigger notification of exit listeners. Don't call _async_wait()
32 + # yet, since that could trigger event loop recursion if the
33 + # current (cancelled) task's exit callback does not set the
34 + # returncode first.
35 + pass
36 + else:
37 + self._async_wait()
38
39 def _wait(self):
40 CompositeTask._wait(self)