From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Rv0iM-0000Q1-Qn for garchives@archives.gentoo.org; Wed, 08 Feb 2012 06:09:11 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5D923E0802; Wed, 8 Feb 2012 06:09:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 23F1EE07D5 for ; Wed, 8 Feb 2012 06:09:03 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9E6421B4036 for ; Wed, 8 Feb 2012 06:09:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D3BF180043 for ; Wed, 8 Feb 2012 06:09:01 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/QueueScheduler.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: c02b0e535a4cfe4dc0a3c3d07124b8dfa5d4f9a5 Date: Wed, 8 Feb 2012 06:09:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 7368964c-df84-4e1b-93ba-3b23affe1e05 X-Archives-Hash: c0e96ad37e26546d418d41063470fd8f commit: c02b0e535a4cfe4dc0a3c3d07124b8dfa5d4f9a5 Author: Zac Medico gentoo org> AuthorDate: Wed Feb 8 05:03:32 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Feb 8 06:08:45 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dc02b0e53 QueueScheduler: tweak timeout handling --- pym/_emerge/QueueScheduler.py | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pym/_emerge/QueueScheduler.py b/pym/_emerge/QueueScheduler.p= y index 91a2831..e115ba1 100644 --- a/pym/_emerge/QueueScheduler.py +++ b/pym/_emerge/QueueScheduler.py @@ -1,8 +1,6 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -import time - from _emerge.PollScheduler import PollScheduler =20 class QueueScheduler(PollScheduler): @@ -36,25 +34,28 @@ class QueueScheduler(PollScheduler): =20 def run(self, timeout=3DNone): =20 - timeout_id =3D None + timeout_callback =3D None if timeout is not None: def timeout_callback(): - raise StopIteration() - timeout_id =3D self._timeout_add(timeout, timeout_callback) + timeout_callback.timed_out =3D True + return False + timeout_callback.timed_out =3D False + timeout_callback.timeout_id =3D self._timeout_add( + timeout, timeout_callback) =20 try: =20 - while self._schedule(): + while not (timeout_callback is not None and + timeout_callback.timed_out) and self._schedule(): self._iteration() =20 - while self._running_job_count(): + while not (timeout_callback is not None and + timeout_callback.timed_out) and self._running_job_count(): self._iteration() =20 - except StopIteration: - pass - - if timeout_id is not None: - self._unregister(timeout_id) + finally: + if timeout_callback is not None: + self._unregister(timeout_callback.timeout_id) =20 def _schedule_tasks(self): """