Skip to content

Commit

Permalink
fix(iteration): Remember to try one last time before giving up
Browse files Browse the repository at this point in the history
  • Loading branch information
sd-yip authored and Addono committed Feb 2, 2021
1 parent c4d125f commit 2ed5308
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wait-for
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ wait_for() {
exit 1
fi

for i in `seq $TIMEOUT` ; do
while :; do
nc -z "$HOST" "$PORT" > /dev/null 2>&1

result=$?
Expand All @@ -35,6 +35,12 @@ wait_for() {
fi
exit 0
fi

if [ "$TIMEOUT" -le 0 ]; then
break
fi
TIMEOUT=$((TIMEOUT - 1))

sleep 1
done
echo "Operation timed out" >&2
Expand Down

0 comments on commit 2ed5308

Please sign in to comment.