changed retry frequenc, added more error messages for failures.

This commit is contained in:
Bhaskar Brahma 2019-10-07 11:31:19 -07:00
Родитель b09c9b7ba7
Коммит e57d26685d
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -53,19 +53,22 @@ write_status() {
check_binary_write_lock() {
set +e # disable exit on non-zero return code
local retry_attempts=0
while (( retry_attempts < 3 )); do
while (( retry_attempts < 10 )); do
lsof_output="$(lsof ${bin})"
if [ "$?" -eq 0 ]; then
echo "${HANDLER_BIN} is open by the following processes: "
echo "${lsof_output}"
((++retry_attempts))
echo "sleeping for 30 seconds before retry, attempt ${retry_attempts} of 3"
sleep 30
echo "sleeping for 3 seconds before retry, attempt ${retry_attempts} of 10"
sleep 3
else
set -e
return 0 #Success path
fi
done
echo "Timed out waiting for lock on ${HANDLER_BIN}"
echo "File handle is still open by the following processes: "
echo "${lsof_output}"
exit 1
}