Browse Source

Merge pull request #345 from Neilpang/dev

add retry for temp authz request error
pull/354/head
neil 8 years ago
committed by GitHub
parent
commit
0383c33558
  1. 16
      acme.sh

16
acme.sh

@ -2282,12 +2282,28 @@ issue() {
_info "Getting new-authz for domain" $d _info "Getting new-authz for domain" $d
_Max_new_authz_retry_times=5
_authz_i=0
while [ "$_authz_i" -lt "$_Max_new_authz_retry_times" ] ; do
_info "Try new-authz for the $_authz_i time."
if ! _send_signed_request "$API/acme/new-authz" "{\"resource\": \"new-authz\", \"identifier\": {\"type\": \"dns\", \"value\": \"$(_idn "$d")\"}}" ; then if ! _send_signed_request "$API/acme/new-authz" "{\"resource\": \"new-authz\", \"identifier\": {\"type\": \"dns\", \"value\": \"$(_idn "$d")\"}}" ; then
_err "Can not get domain token." _err "Can not get domain token."
_clearup _clearup
_on_issue_err _on_issue_err
return 1 return 1
fi fi
if ! _contains "$response" "An error occurred while processing your request" ; then
_info "The new-authz request is ok."
break
fi
_authz_i="$(_math "$_authz_i" + 1)"
_info "Sleep $_authz_i to retry."
_sleep "$_authz_i"
done;
if [ "$_authz_i" = "$_Max_new_authz_retry_times" ] ; then
_debug "new-authz retry reach the max $_Max_new_authz_retry_times times."
fi
if [ ! -z "$code" ] && [ ! "$code" = '201' ] ; then if [ ! -z "$code" ] && [ ! "$code" = '201' ] ; then
_err "new-authz error: $response" _err "new-authz error: $response"

Loading…
Cancel
Save