diff options
author | Zac Medico <zmedico@gentoo.org> | 2018-04-29 14:39:28 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2018-04-29 14:41:07 -0700 |
commit | 4da425966a82bfbbb68908010995941a44b45598 (patch) | |
tree | 24f753aae6a8d693c58473ba88645ac67944a6d1 /pym/_emerge | |
parent | SubProcess: add_child_handler asyncio compat (bug 654276) (diff) | |
download | portage-4da425966a82bfbbb68908010995941a44b45598.tar.gz portage-4da425966a82bfbbb68908010995941a44b45598.tar.bz2 portage-4da425966a82bfbbb68908010995941a44b45598.zip |
AbstractEbuildProcess: call_later asyncio compat (bug 591760)
Use call_later for asyncio compatibility.
Bug: https://bugs.gentoo.org/591760
Diffstat (limited to 'pym/_emerge')
-rw-r--r-- | pym/_emerge/AbstractEbuildProcess.py | 11 | ||||
-rw-r--r-- | pym/_emerge/SubProcess.py | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 2ed175750..ccc3b8e32 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -37,7 +37,7 @@ class AbstractEbuildProcess(SpawnProcess): # doesn't hurt to be generous here since the scheduler # continues to process events during this period, and it can # return long before the timeout expires. - _exit_timeout = 10000 # 10 seconds + _exit_timeout = 10 # seconds # The EbuildIpcDaemon support is well tested, but this variable # is left so we can temporarily disable it if any issues arise. @@ -247,7 +247,7 @@ class AbstractEbuildProcess(SpawnProcess): if self._registered: # Let the process exit naturally, if possible. self._exit_timeout_id = \ - self.scheduler.timeout_add(self._exit_timeout, + self.scheduler.call_later(self._exit_timeout, self._exit_command_timeout_cb) def _exit_command_timeout_cb(self): @@ -258,17 +258,14 @@ class AbstractEbuildProcess(SpawnProcess): # being killed by a signal. self.cancel() self._exit_timeout_id = \ - self.scheduler.timeout_add(self._cancel_timeout, + self.scheduler.call_later(self._cancel_timeout, self._cancel_timeout_cb) else: self._exit_timeout_id = None - return False # only run once - def _cancel_timeout_cb(self): self._exit_timeout_id = None self._async_waitpid() - return False # only run once def _orphan_process_warn(self): phase = self.phase @@ -363,7 +360,7 @@ class AbstractEbuildProcess(SpawnProcess): SpawnProcess._async_waitpid_cb(self, *args, **kwargs) if self._exit_timeout_id is not None: - self.scheduler.source_remove(self._exit_timeout_id) + self._exit_timeout_id.cancel() self._exit_timeout_id = None if self._ipc_daemon is not None: diff --git a/pym/_emerge/SubProcess.py b/pym/_emerge/SubProcess.py index aa4778737..a37482ca4 100644 --- a/pym/_emerge/SubProcess.py +++ b/pym/_emerge/SubProcess.py @@ -16,7 +16,7 @@ class SubProcess(AbstractPollTask): # This is how much time we allow for waitpid to succeed after # we've sent a kill signal to our subprocess. - _cancel_timeout = 1000 # 1 second + _cancel_timeout = 1 # seconds def _poll(self): # Simply rely on _async_waitpid_cb to set the returncode. |