[Dev] Do not kill child jobs when stopping runner and deployer

This commit is contained in:
samuel 2023-05-07 15:34:34 +02:00
parent 8df10d8ad4
commit 711ad6dc9e
2 changed files with 4 additions and 26 deletions

View File

@ -233,25 +233,15 @@ process_loop() (
log_info "Process new request '${request}'."
process_request &
done < <(ncat --listen --keep-open --unixsock "${deployer_sock}")
log_critical "Unexpected end of listening at '${deployer_sock}'."
else
log_info "Start listening unixsock without keep-open at '${deployer_sock}'."
while read -r request; do
log_info "Process new request '${request}'."
process_request
done < <(ncat --listen --unixsock "${deployer_sock}")
log_info "End of listening at '${deployer_sock}'."
fi
# Kill all remaining subprocesses only if daemon.
log_info "End of loop."
if "${daemon}"; then
log_debug "Kill child jobs."
jobs -p | xargs kill 2>/dev/null || true
fi
# Remove sock file
log_debug "Remove deployer unixsock file."
rm --force "${deployer_sock}"
log_info "End of process."
)
main() (
@ -433,7 +423,6 @@ main() (
log_info "Run process loop in foreground."
echo "$$" >"${deployer_pid}"
process_loop
jobs -p | xargs kill 2>/dev/null || true
fi
;;
stop)

View File

@ -293,25 +293,15 @@ process_loop() (
log_info "Process new request '${request}'."
process_request &
done < <(ncat --listen --keep-open --unixsock "${runner_sock}")
log_critical "Unexpected end of listening at '${deployer_sock}'."
else
log_info "Start listening unixsock without keep-open at '${runner_sock}'."
while read -r request; do
log_info "Process new request '${request}'."
process_request
done < <(ncat --listen --unixsock "${runner_sock}")
log_info "End of listening at '${deployer_sock}'."
fi
# Kill all remaining subprocesses only if daemon.
log_info "End of loop."
if "${daemonize}"; then
log_debug "Kill child jobs."
jobs -p | xargs kill 2>/dev/null || true
fi
# Remove sock file.
log_debug "Remove deployer unixsock file."
rm --force "${runner_sock}"
log_info "End of process."
)
main() (
@ -534,7 +524,6 @@ main() (
log_info "Run process loop in foreground."
echo "$$" >"${runner_pid}"
process_loop
jobs -p | xargs kill 2>/dev/null || true
fi
;;
stop)