[Fix] Add a timeout for each inotifywait to prevent eventual locks

This commit is contained in:
samuel 2023-04-30 23:31:43 +02:00
parent c28172b63f
commit 48ab309698
5 changed files with 12 additions and 6 deletions

View File

@ -395,7 +395,8 @@ main() (
# Set right access in background after nc listen. # Set right access in background after nc listen.
( (
inotifywait --event create "$(dirname "${deployer_sock}")" --quiet --quiet inotifywait --timeout 1 --quiet --quiet \
--event create "$(dirname "${deployer_sock}")" || true
chmod 775 "${deployer_sock}" chmod 775 "${deployer_sock}"
chgrp "${runner_deployer_groupname}" "${deployer_sock}" chgrp "${runner_deployer_groupname}" "${deployer_sock}"
) & ) &

View File

@ -240,7 +240,8 @@ main() (
# Send request to runner. # Send request to runner.
mkdir "${rd_pipeline_sock_dir}" mkdir "${rd_pipeline_sock_dir}"
( (
inotifywait --quiet --quiet --event create "${rd_pipeline_sock_dir}" inotifywait --timeout 1 --quiet --quiet \
--event create "${rd_pipeline_sock_dir}" || true
chmod 775 "${rd_pipeline_sock}" chmod 775 "${rd_pipeline_sock}"
chgrp "${git_runner_groupname}" "${rd_pipeline_sock}" chgrp "${git_runner_groupname}" "${rd_pipeline_sock}"
echo "${runner_request}" | ncat --unixsock "${runner_sock}" echo "${runner_request}" | ncat --unixsock "${runner_sock}"

View File

@ -263,7 +263,8 @@ process_request() (
--arg v "$(make version)" \ --arg v "$(make version)" \
'{"response_sock":$s,"pkg_name":$n,"pkg_version":$v}')" '{"response_sock":$s,"pkg_name":$n,"pkg_version":$v}')"
( (
inotifywait --event create "${repo_clone}" 1>/dev/null 2>/dev/null inotifywait --timeout 1 --quiet --quiet \
--event create "${repo_clone}" || true
chmod 775 "${repo_clone}/runner.sock" chmod 775 "${repo_clone}/runner.sock"
chgrp "${runner_deployer_groupname}" "${repo_clone}/runner.sock" chgrp "${runner_deployer_groupname}" "${repo_clone}/runner.sock"
echo "${deployer_request}" | ncat --unixsock "${deployer_sock}" echo "${deployer_request}" | ncat --unixsock "${deployer_sock}"
@ -489,7 +490,8 @@ main() (
# Set right access in background after nc listen. # Set right access in background after nc listen.
( (
inotifywait --event create "$(dirname "${runner_sock}")" --quiet --quiet inotifywait --timeout 1 --quiet --quiet \
--event create "$(dirname "${runner_sock}")" || true
chmod 775 "${runner_sock}" chmod 775 "${runner_sock}"
chgrp "${git_runner_groupname}" "${runner_sock}" chgrp "${git_runner_groupname}" "${runner_sock}"
) & ) &

View File

@ -45,7 +45,8 @@ send_request() (
"${deployer_bin}" --conf="${conf_file}" --errs="${errs_file}" \ "${deployer_bin}" --conf="${conf_file}" --errs="${errs_file}" \
--daemon --once --verbose || return $? --daemon --once --verbose || return $?
( (
inotifywait --event create --quiet --quiet "${response_sock_dir}" inotifywait --timeout 1 --quiet --quiet \
--event create "${response_sock_dir}" || true
echo "${request}" | ncat --unixsock "${deployer_sock}" echo "${request}" | ncat --unixsock "${deployer_sock}"
) & ) &
return "$(ncat --listen --unixsock "${response_sock}" | jq .code)" return "$(ncat --listen --unixsock "${response_sock}" | jq .code)"

View File

@ -53,7 +53,8 @@ send_request() (
return "${code}" return "${code}"
fi fi
( (
inotifywait --quiet --quiet --event create "${response_sock_dir}" inotifywait --timeout 1 --quiet --quiet \
--event create "${response_sock_dir}" >&3
echo "${request}" | ncat --unixsock "${runner_sock}" echo "${request}" | ncat --unixsock "${runner_sock}"
) & ) &
echo "done" | ncat --unixsock "${deployer_sock}" echo "done" | ncat --unixsock "${deployer_sock}"