Skip to content

Commit

Permalink
Limit number of attempts in chain waiting script
Browse files Browse the repository at this point in the history
  • Loading branch information
gztensor committed Jul 30, 2024
1 parent 4e3946d commit 329c8ea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/wait_first_block_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,30 @@ function reset_check {
block_id=0
}

max_attempts=10
attempt=0
while ! had_new_block; do
echo "Waiting for next block..."
sleep 6
((attempt++))
if (( attempt >= max_attempts )); then
echo "Reached maximum number of attempts, exiting..."
exit 1
fi
done
reset_check

echo "Chain is running"

attempt=0
while ! had_new_block; do
echo "Waiting for another block..."
sleep 6
((attempt++))
if (( attempt >= max_attempts )); then
echo "Reached maximum number of attempts, exiting..."
exit 1
fi
done

echo "Chain is definitely running!"

0 comments on commit 329c8ea

Please sign in to comment.