Merge rade/992_fractional_sleep (PR #993)

Sleep for 0.1s instead of 1s in the wait_for_status loop.

Closes #992.
This commit is contained in:
David Wragg committed 2015-06-24 12:44:52 +01:00
commit 159d47a934
1 file changed
+16 -1
+16 -1
View File
@@ -183,6 +183,21 @@ command_exists() {
command -v $1 >/dev/null 2>&1
}
fractional_sleep() {
case $1 in
*.*)
if [ -z "$NO_FRACTIONAL_SLEEP" ] ; then
sleep $1 >/dev/null 2>&1 && return 0
NO_FRACTIONAL_SLEEP=1
fi
sleep $((${1%.*} + 1))
;;
*)
sleep $1
;;
esac
}
run_iptables() {
# -w is recent addition to iptables
if [ -z "$CHECKED_IPTABLES_W" ] ; then
@@ -585,7 +600,7 @@ wait_for_status() {
echo "$err_msg" >&2
return 1
fi
sleep 1
fractional_sleep 0.1
done
}