diff --git a/proxy_docker/app/script/batching.sh b/proxy_docker/app/script/batching.sh index 6982a6a..2a59e4d 100644 --- a/proxy_docker/app/script/batching.sh +++ b/proxy_docker/app/script/batching.sh @@ -601,6 +601,7 @@ batch_webhooks() { local body local successful_recipient_ids local returncode + local response outputs=$(echo "${webhooks_data}" | jq -Mc ".[]") @@ -626,7 +627,7 @@ batch_webhooks() { body='{"outputId":'${output_id}',"address":'${address}',"amount":'${amount}','${tx}'}' trace "[batch_webhooks] body=${body}" - notify_web "${webhook_url}" "${body}" ${TOR_ADDR_WATCH_WEBHOOKS} + response=$(notify_web "${webhook_url}" "${body}" ${TOR_ADDR_WATCH_WEBHOOKS}) returncode=$? trace_rc ${returncode} diff --git a/proxy_docker/app/script/callbacks_job.sh b/proxy_docker/app/script/callbacks_job.sh index 1a6508a..fdefac3 100644 --- a/proxy_docker/app/script/callbacks_job.sh +++ b/proxy_docker/app/script/callbacks_job.sh @@ -253,8 +253,9 @@ curl_callback() { trace "Entering curl_callback()..." local returncode + local response - notify_web "${1}" "${2}" ${TOR_ADDR_WATCH_WEBHOOKS} + response=$(notify_web "${1}" "${2}" ${TOR_ADDR_WATCH_WEBHOOKS}) returncode=$? trace_rc ${returncode} diff --git a/proxy_docker/app/script/callbacks_txid.sh b/proxy_docker/app/script/callbacks_txid.sh index 0358057..7ef7823 100644 --- a/proxy_docker/app/script/callbacks_txid.sh +++ b/proxy_docker/app/script/callbacks_txid.sh @@ -147,8 +147,9 @@ curl_callback_txid() { trace "Entering curl_callback_txid()..." local returncode + local response - notify_web "${1}" "${2}" ${TOR_TXID_WATCH_WEBHOOKS} + response=$(notify_web "${1}" "${2}" ${TOR_TXID_WATCH_WEBHOOKS}) returncode=$? trace_rc ${returncode} diff --git a/proxy_docker/app/script/newblock.sh b/proxy_docker/app/script/newblock.sh index eb4c49d..6db875a 100644 --- a/proxy_docker/app/script/newblock.sh +++ b/proxy_docker/app/script/newblock.sh @@ -6,6 +6,9 @@ . ./batching.sh newblock() { + ( + flock -x 202 + trace "Entering newblock()..." local request=${1} @@ -24,4 +27,6 @@ newblock() { do_callbacks_txid batch_check_webhooks + + ) 202>./.newblock.lock } diff --git a/proxy_docker/app/script/notify.sh b/proxy_docker/app/script/notify.sh index 4979297..42d9fa7 100644 --- a/proxy_docker/app/script/notify.sh +++ b/proxy_docker/app/script/notify.sh @@ -37,6 +37,8 @@ notify_web() { http_code=$(echo "${response}" | jq -r ".http_code") trace "[notify_web] http_code=${http_code}" + echo "${response}" + if [ "${curl_code}" -eq "0" ] && [ "${returncode}" -eq "0" ]; then if [ "${http_code}" -lt "400" ]; then return 0 diff --git a/proxy_docker/app/script/ots.sh b/proxy_docker/app/script/ots.sh index c72a182..2db2b11 100644 --- a/proxy_docker/app/script/ots.sh +++ b/proxy_docker/app/script/ots.sh @@ -150,6 +150,7 @@ serve_ots_backoffice() { local result local returncode + local response # Let's fetch all the incomplete stamping request local callbacks=$(sql 'SELECT hash, callbackUrl, requested, upgraded, id FROM stamp WHERE NOT calledback') @@ -213,7 +214,7 @@ serve_ots_backoffice() { if [ -n ${url} ]; then trace "[serve_ots_backoffice] url is not empty, now trying to call it!" - notify_web "${url}" ${TOR_OTS_WEBHOOKS} + response=$(notify_web "${url}" ${TOR_OTS_WEBHOOKS}) returncode=$? trace_rc ${returncode}