1 |
commit: 071fa4eb82ba9dbb2f0ae3c78cb87580eb6baeff |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 8 05:03:32 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 8 05:03:32 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=071fa4eb |
7 |
|
8 |
QueueScheduler: tweak timeout handling |
9 |
|
10 |
--- |
11 |
pym/_emerge/QueueScheduler.py | 23 +++++++++++++---------- |
12 |
1 files changed, 13 insertions(+), 10 deletions(-) |
13 |
|
14 |
diff --git a/pym/_emerge/QueueScheduler.py b/pym/_emerge/QueueScheduler.py |
15 |
index 91a2831..db7aa5a 100644 |
16 |
--- a/pym/_emerge/QueueScheduler.py |
17 |
+++ b/pym/_emerge/QueueScheduler.py |
18 |
@@ -36,25 +36,28 @@ class QueueScheduler(PollScheduler): |
19 |
|
20 |
def run(self, timeout=None): |
21 |
|
22 |
- timeout_id = None |
23 |
+ timeout_callback = None |
24 |
if timeout is not None: |
25 |
def timeout_callback(): |
26 |
- raise StopIteration() |
27 |
- timeout_id = self._timeout_add(timeout, timeout_callback) |
28 |
+ timeout_callback.timed_out = True |
29 |
+ return False |
30 |
+ timeout_callback.timed_out = False |
31 |
+ timeout_callback.timeout_id = self._timeout_add( |
32 |
+ timeout, timeout_callback) |
33 |
|
34 |
try: |
35 |
|
36 |
- while self._schedule(): |
37 |
+ while not (timeout_callback is not None and |
38 |
+ timeout_callback.timed_out) and self._schedule(): |
39 |
self._iteration() |
40 |
|
41 |
- while self._running_job_count(): |
42 |
+ while not (timeout_callback is not None and |
43 |
+ timeout_callback.timed_out) and self._running_job_count(): |
44 |
self._iteration() |
45 |
|
46 |
- except StopIteration: |
47 |
- pass |
48 |
- |
49 |
- if timeout_id is not None: |
50 |
- self._unregister(timeout_id) |
51 |
+ finally: |
52 |
+ if timeout_callback is not None: |
53 |
+ self._unregister(timeout_callback.timeout_id) |
54 |
|
55 |
def _schedule_tasks(self): |
56 |
""" |