From 4b7dcbf188efbfe1c16e3012adc5b6babcb67418 Mon Sep 17 00:00:00 2001 From: Flouse Date: Tue, 11 May 2021 04:31:55 +0000 Subject: [PATCH] fix(isRollupCellExits): curl retry on connrefused, considering ECONNREFUSED as a transient error(network issues) see also: https://github.com/appropriate/docker-curl/issues/5#issuecomment-461338326 https://github.com/sameersbn/docker-gitlab/pull/2088 https://curl.se/docs/manpage.html#--retry-connrefused --- gw_util.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gw_util.sh b/gw_util.sh index 4e7dbd3c..e1a9207a 100755 --- a/gw_util.sh +++ b/gw_util.sh @@ -52,6 +52,9 @@ isRollupCellExits(){ rollup_hash_type=$( parse_toml_with_section "$tomlconfigfile" "chain.rollup_type_script" "hash_type" ) rollup_args=$( parse_toml_with_section "$tomlconfigfile" "chain.rollup_type_script" "args" ) + # curl retry on connrefused, considering ECONNREFUSED as a transient error(network issues) + # connections with ipv6 are not retried because it returns EADDRNOTAVAIL instead of ECONNREFUSED, + # hence we should use --ipv4 result=$( echo '{ "id": 2, "jsonrpc": "2.0", @@ -70,8 +73,9 @@ isRollupCellExits(){ ] }' \ | tr -d '\n' \ - | curl -H 'content-type: application/json' -d @- \ - http://localhost:8116 ) + | curl --ipv4 --retry 3 --retry-connrefused \ + -H 'content-type: application/json' -d @- \ + http://localhost:8116) if [[ $result =~ "block_number" ]]; then echo "Rollup cell exits!"