From 78fb3dc32f9de6274fa0843d54c3ab704ae95d1a Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Tue, 18 Mar 2025 11:01:42 +0100 Subject: [PATCH] more timeout for ref urls --- check-health.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/check-health.sh b/check-health.sh index c507a74f..c13cb2f2 100755 --- a/check-health.sh +++ b/check-health.sh @@ -3,6 +3,8 @@ RPC_URL="$1" ref="$2" +timeout=2 # seconds + response_file=$(mktemp) http_status_code=$(curl --ipv4 -m 1 -s -X POST -w "%{http_code}" -o "$response_file" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' $RPC_URL) @@ -22,7 +24,7 @@ if [ $? -eq 0 ]; then latest_block_hash=$(echo "$response" | jq -r '.result.hash') response_file2=$(mktemp) - http_status_code2=$(curl --ipv4 -m 1 -s -X POST -w "%{http_code}" -o "$response_file2" -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"$latest_block_number\", false],\"id\":1}" $ref) + http_status_code2=$(curl --ipv4 -m $timeout -s -X POST -w "%{http_code}" -o "$response_file2" -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"$latest_block_number\", false],\"id\":1}" $ref) if [ $? -eq 0 ]; then if [[ $http_status_code2 -eq 200 ]]; then response2=$(cat "$response_file2") @@ -33,7 +35,7 @@ if [ $? -eq 0 ]; then if [ "$latest_block_hash" == "$latest_block_hash2" ]; then response_file3=$(mktemp) - http_status_code=$(curl --ipv4 -m 1 -s -X POST -w "%{http_code}" -o "$response_file3" -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"latest\", false],\"id\":1}" $ref) + http_status_code=$(curl --ipv4 -m $timeout -s -X POST -w "%{http_code}" -o "$response_file3" -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"latest\", false],\"id\":1}" $ref) if [ $? -eq 0 ]; then if [[ $http_status_code -eq 200 ]]; then