mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-27 07:21:53 +00:00
add retry for init api
This commit is contained in:
parent
f41f93af3a
commit
014e016058
20
acme.sh
20
acme.sh
@ -2540,12 +2540,18 @@ _initAPI() {
|
|||||||
_api_server="${1:-$ACME_DIRECTORY}"
|
_api_server="${1:-$ACME_DIRECTORY}"
|
||||||
_debug "_init api for server: $_api_server"
|
_debug "_init api for server: $_api_server"
|
||||||
|
|
||||||
if [ -z "$ACME_NEW_ACCOUNT" ]; then
|
MAX_API_RETRY_TIMES=10
|
||||||
|
_sleep_retry_sec=10
|
||||||
|
_request_retry_times=0
|
||||||
|
while [ -z "$ACME_NEW_ACCOUNT" ] && [ "${_request_retry_times}" -lt "$MAX_API_RETRY_TIMES" ]; do
|
||||||
|
_request_retry_times=$(_math "$_request_retry_times" + 1)
|
||||||
response=$(_get "$_api_server")
|
response=$(_get "$_api_server")
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
_debug2 "response" "$response"
|
_debug2 "response" "$response"
|
||||||
_err "Can not init api for: $_api_server."
|
_info "Can not init api for: $_api_server."
|
||||||
return 1
|
_info "Sleep $_sleep_retry_sec and retry."
|
||||||
|
_sleep "$_sleep_retry_sec"
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
response=$(echo "$response" | _json_decode)
|
response=$(echo "$response" | _json_decode)
|
||||||
_debug2 "response" "$response"
|
_debug2 "response" "$response"
|
||||||
@ -2578,8 +2584,12 @@ _initAPI() {
|
|||||||
_debug "ACME_REVOKE_CERT" "$ACME_REVOKE_CERT"
|
_debug "ACME_REVOKE_CERT" "$ACME_REVOKE_CERT"
|
||||||
_debug "ACME_AGREEMENT" "$ACME_AGREEMENT"
|
_debug "ACME_AGREEMENT" "$ACME_AGREEMENT"
|
||||||
_debug "ACME_NEW_NONCE" "$ACME_NEW_NONCE"
|
_debug "ACME_NEW_NONCE" "$ACME_NEW_NONCE"
|
||||||
|
if [ "$ACME_KEY_CHANGE" ] && [ "$ACME_NEW_AUTHZ" ] && [ "$ACME_NEW_ORDEW_ACCOUNT" ] && [ "$ACME_REVOR" ] && [ "$ACME_NEKE_CERT" ]; then
|
||||||
fi
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
_err "Can not init api, for $_api_server"
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[domain] [keylength or isEcc flag]
|
#[domain] [keylength or isEcc flag]
|
||||||
|
Loading…
Reference in New Issue
Block a user