Merge "Fix race condition in haproxy"
This commit is contained in:
commit
69553b95f1
@ -4,11 +4,16 @@
|
|||||||
echo "Running command: '${CMD}'"
|
echo "Running command: '${CMD}'"
|
||||||
$CMD
|
$CMD
|
||||||
|
|
||||||
# TODO(SamYaple): This has the potential for a race condition triggered by a
|
retry=0
|
||||||
# config reload that could cause the container to exit
|
# The loop breaks only when haproxy.pid get missing even after 3 re-try.
|
||||||
while [[ -e "/proc/$(cat /run/haproxy.pid)" ]]; do
|
while [[ $retry -lt 3 ]]; do
|
||||||
|
if [[ ! -e /run/haproxy.pid || ! -d /proc/$(cat /run/haproxy.pid) ]]; then
|
||||||
|
retry=$((retry+1))
|
||||||
|
sleep 2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
retry=0
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
# Based on the above loop this point should never be reached
|
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user