Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge rade/992_fractional_sleep (PR #993)
Browse files Browse the repository at this point in the history
Sleep for 0.1s instead of 1s in the wait_for_status loop.

Closes #992.
  • Loading branch information
dpw committed Jun 24, 2015
2 parents 3c7cff1 + 4b11874 commit 159d47a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion weave
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -585,7 +600,7 @@ wait_for_status() {
echo "$err_msg" >&2
return 1
fi
sleep 1
fractional_sleep 0.1
done
}

Expand Down

0 comments on commit 159d47a

Please sign in to comment.