From 117dd31d5322c071b4b348b61b0ef741a6044926 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Mon, 27 May 2024 18:25:58 +0300 Subject: Added hardcoded timeout for curl calls --- lib/_ak_zblock | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/_ak_zblock') diff --git a/lib/_ak_zblock b/lib/_ak_zblock index e1e6914..cb6af36 100755 --- a/lib/_ak_zblock +++ b/lib/_ak_zblock @@ -601,7 +601,12 @@ _ak_zblock_pack(){ _ak_zblock_announce(){ if [ ! -z "$1" ] && [ -n "$1" ] then - curl http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$1'"}' 2>/dev/null | jq -M -c > /dev/null + curl \ + --connect-timeout 3 \ + --header 'Content-Type: application/json' \ + --data-raw '{"zblock":"'$1'"}' \ + "http://127.0.0.1:8610/v0/announce/zblock" \ + 2>/dev/null | jq -M -c > /dev/null if [ $? -ne 0 ] then logit "ERROR" "zblock $zblock announcement failed" @@ -609,7 +614,12 @@ _ak_zblock_announce(){ logit "INFO" "zblock $zblock announced" fi else - curl http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$(ak-get-zlatest)'"}' 2>/dev/null | jq -M -c > /dev/null + curl \ + --connect-timeout 3 \ + --header 'Content-Type: application/json' \ + --data-raw '{"zblock":"'$(ak-get-zlatest)'"}' \ + "http://127.0.0.1:8610/v0/announce/zblock" \ + 2>/dev/null | jq -M -c > /dev/null if [ $? -ne 0 ] then logit "ERROR" "zblock $zblock announcement failed" -- cgit v1.2.3