Skip to content

Commit

Permalink
Address peer review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
  • Loading branch information
ivanpauno committed Dec 1, 2022
1 parent 85ea3a9 commit ee89dc1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions launch/launch/actions/execute_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,6 @@ async def _signal_subprocesses(self, context):
log_prefix_format = (
'subprocess[pid={}] of process['
f'{process_name}, pid={process_pid}]: ')
# signal_subprocesses_timeout_v = perform_substitutions(
# context, signal_subprocesses_timeout)
next_signals = iter(((signal.SIGTERM, sigterm_timeout), (signal.SIGKILL, sigkill_timeout)))
while True:
for p in to_signal:
Expand All @@ -559,13 +557,15 @@ async def _signal_subprocesses(self, context):
sig, timeout = next(next_signals)
except StopIteration:
return
while context.asyncio_loop.time() < start_time + timeout:
await asyncio.sleep(0.5)
current_time = context.asyncio_loop.time()
while current_time < start_time + timeout:
await asyncio.sleep(min(0.5, start_time + timeout - current_time))
for p in list(signaled):
log_prefix = log_prefix_format.format(p.pid)
if not p.is_running():
self.__logger.info(f'{log_prefix} exited')
log_prefix = log_prefix_format.format(p.pid)
self.__logger.info(f'{log_prefix}exited')
signaled.remove(p)
current_time = context.asyncio_loop.time()
to_signal = signaled
signaled = []

Expand Down

0 comments on commit ee89dc1

Please sign in to comment.