Skip to content
Snippets Groups Projects
Commit 4bd624aa authored by Anthony GRAIGNIC's avatar Anthony GRAIGNIC
Browse files

Add healthcheck before starting simulation script

parent d4b1fb8d
No related branches found
No related tags found
No related merge requests found
Pipeline #6646 passed
......@@ -7,9 +7,27 @@ export MNEMONIC='before exclude interest push zone jealous boat ice chimney juic
export RPC_URL=http://127.0.0.1:8545;
export CHAIN_ID=636363;
# Check if RPC node is available before starting the simulation
MAX_ATTEMPTS=5
DELAY_BETWEEN_ATTEMPS=3
attempt=1
while true; do
# test=$(curl --fail --max-time 3 --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83 }' --location $RPC_URL | grep '"result":"0x0"')
response=$(curl -s -o /dev/null --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83 }' -w "%{http_code}" $RPC_URL)
if [ "$response" == "200" ]; then
break
fi
echo "RPC node not ready, let's wait $DELAY_BETWEEN_ATTEMPS seconds"
sleep "$DELAY_BETWEEN_ATTEMPS"
attempt=$((attempt + 1))
if [ "$attempt" -gt "$MAX_ATTEMPTS" ]; then
exit 1
fi
done
# ./target/release/testnet-injector simulate-bx-from-csv ../movement-data/public-transport/MF_user_mobility_june-to-august-2023_mulhouse_dataset/anonymized_june-to-august-2023_mulhouse_dataset.csv $TOTAL_SIMULATION_TIME &
# Send BX
./target/release/testnet-injector simulate-bx-from-csv ./data/anonymized_june-to-november-2023_france_dataset.csv $TOTAL_SIMULATION_TIME &
echo "TOTAL_SIMULATION_TIME = $TOTAL_SIMULATION_TIME and block time = $BLOCK_TIME"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment