Skip to content

Commit

Permalink
Merge pull request #128 from Krishnendu2460/updated_script
Browse files Browse the repository at this point in the history
Fixed stucking at infinte loop
  • Loading branch information
biplamal authored Dec 5, 2024
2 parents 01a46c9 + 844a667 commit b9a4859
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,22 @@ gen_openconfig_models_sdk() {
}
wait_for_sock() {
start=$SECONDS
TIMEOUT_SECONDS=30
if [ ! -z "${3}" ]
then
TIMEOUT_SECONDS=${3}
fi
echo "Waiting for ${1}:${2} to be ready (timeout=${TIMEOUT_SECONDS}s)..."
start_time=$(date +%S)
while true
do
nc -z -v ${1} ${2} && return 0
elapsed=$(( SECONDS - start ))
current_time=$(date +%S)
elapsed=$(( current_time - start_time ))
echo "elapsed time: $elapsed"
if [ $elapsed -gt ${TIMEOUT_SECONDS} ]
then
echo "${1}:${2} to be ready after ${TIMEOUT_SECONDS}s"
Expand Down

0 comments on commit b9a4859

Please sign in to comment.