Skip to content

Commit 77d4fa8

Browse files
fab-10marioevz
andauthored
clients/besu: implement retry mechanism to get enode (#595)
* clients/besu: implement retry mechanism to get enode * exit if enode URL not available after 5 seconds Co-authored-by: Mario Vega <marioevz@gmail.com>
1 parent 05023d3 commit 77d4fa8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clients/besu/enode.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
set -e
1111

1212
data='{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":1}'
13-
TARGET_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" --data $data "localhost:8545" )
13+
while [[ "$TARGET_RESPONSE" != *enode* ]]
14+
do
15+
TARGET_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" --data $data "localhost:8545" )
16+
((c++)) && ((c==50)) && break
17+
sleep 0.1
18+
done
1419

1520
TARGET_ENODE=$(echo ${TARGET_RESPONSE}| jq -r '.result.enode')
1621
echo "$TARGET_ENODE"

0 commit comments

Comments
 (0)