Commit a298fd5a authored by Iustin Pop's avatar Iustin Pop
Browse files

utils._RunCmdPipe: fix poller timeout usage



This patch makes a simple timeout test (e.g. testTimeoutKill) go from
13K poll syscalls to just 6. The code didn't take into account that
RunningTimeout talks in seconds while the poller object expects
milliseconds.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 815bf6d5
......@@ -567,7 +567,7 @@ def _RunCmdPipe(cmd, env, via_shell, cwd, interactive, timeout,
while fdmap:
if poll_timeout:
current_timeout = poll_timeout()
current_timeout = poll_timeout() * 1000
if current_timeout < 0:
if linger_timeout is None:
logging.warning(msg_timeout)
......@@ -575,7 +575,7 @@ def _RunCmdPipe(cmd, env, via_shell, cwd, interactive, timeout,
timeout_action = _TIMEOUT_TERM
IgnoreProcessNotFound(os.kill, child.pid, signal.SIGTERM)
linger_timeout = RunningTimeout(_linger_timeout, True).Remaining
lt = linger_timeout()
lt = linger_timeout() * 1000
if lt < 0:
break
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment