From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7E9C1138331 for ; Sun, 29 Apr 2018 22:24:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8733AE0BA4; Sun, 29 Apr 2018 22:24:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 68977E0BA3 for ; Sun, 29 Apr 2018 22:24:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 33875335C9C for ; Sun, 29 Apr 2018 22:24:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 88CF829F for ; Sun, 29 Apr 2018 22:24:23 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1525040308.abf4b7abcdc53bbbd86eb6f79d45417b54ed64d2.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_async/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/_async/AsyncScheduler.py pym/portage/util/_async/SchedulerInterface.py X-VCS-Directories: pym/portage/util/_async/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: abf4b7abcdc53bbbd86eb6f79d45417b54ed64d2 X-VCS-Branch: master Date: Sun, 29 Apr 2018 22:24:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 9a246824-f06a-4fe9-a589-b4407d749669 X-Archives-Hash: a9e7f4e93c2b2c75401ddb86e603684c commit: abf4b7abcdc53bbbd86eb6f79d45417b54ed64d2 Author: Zac Medico gentoo org> AuthorDate: Sun Apr 29 22:12:13 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Apr 29 22:18:28 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=abf4b7ab AsyncScheduler: call_later asyncio compat (bug 591760) Use call_later for asyncio compatibility. Also remove the timeout_add method from SchedulerInterface, since there are no more consumers. Bug: https://bugs.gentoo.org/591760 pym/portage/util/_async/AsyncScheduler.py | 9 +++++++-- pym/portage/util/_async/SchedulerInterface.py | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pym/portage/util/_async/AsyncScheduler.py b/pym/portage/util/_async/AsyncScheduler.py index 90e803eba..c6b523eaa 100644 --- a/pym/portage/util/_async/AsyncScheduler.py +++ b/pym/portage/util/_async/AsyncScheduler.py @@ -65,6 +65,11 @@ class AsyncScheduler(AsynchronousTask, PollScheduler): task.addExitListener(self._task_exit) task.start() + if self._loadavg_check_id is not None: + self._loadavg_check_id.cancel() + self._loadavg_check_id = self._event_loop.call_later( + self._loadavg_latency, self._schedule) + # Triggers cleanup and exit listeners if there's nothing left to do. self.poll() @@ -80,14 +85,14 @@ class AsyncScheduler(AsynchronousTask, PollScheduler): (self._max_jobs is True or self._max_jobs > 1): # We have to schedule periodically, in case the load # average has changed since the last call. - self._loadavg_check_id = self._event_loop.timeout_add( + self._loadavg_check_id = self._event_loop.call_later( self._loadavg_latency, self._schedule) self._schedule() def _cleanup(self): super(AsyncScheduler, self)._cleanup() if self._loadavg_check_id is not None: - self._event_loop.source_remove(self._loadavg_check_id) + self._loadavg_check_id.cancel() self._loadavg_check_id = None def _async_wait(self): diff --git a/pym/portage/util/_async/SchedulerInterface.py b/pym/portage/util/_async/SchedulerInterface.py index ff39bc587..56b844616 100644 --- a/pym/portage/util/_async/SchedulerInterface.py +++ b/pym/portage/util/_async/SchedulerInterface.py @@ -15,7 +15,6 @@ class SchedulerInterface(SlotObject): "IO_NVAL", "IO_OUT", "IO_PRI", "io_add_watch", "source_remove", - "timeout_add", "add_reader", "add_writer",