From 3ab9b75696f2286834d20c1d3d8ff86e2cd20e30 Mon Sep 17 00:00:00 2001 From: Rekby Date: Mon, 11 Apr 2016 11:43:32 +0300 Subject: [PATCH] simple, without retriing --- acme/jws.go | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/acme/jws.go b/acme/jws.go index 1fc9eaba..ed69f52e 100644 --- a/acme/jws.go +++ b/acme/jws.go @@ -9,14 +9,10 @@ import ( "fmt" "net/http" - "errors" "gopkg.in/square/go-jose.v1" - "time" + "errors" ) -const TRY_COUNT = 10 -const RETRY_PAUSE = time.Second - type jws struct { directoryURL string privKey crypto.PrivateKey @@ -101,24 +97,14 @@ func (j *jws) getNonce() error { func (j *jws) Nonce() (string, error) { nonce := "" if len(j.nonces) == 0 { - for i := 0; i < TRY_COUNT; i++ { - err := j.getNonce() - if err != nil { - return nonce, err - } - if len(j.nonces) != 0 { - // get nonce ok and can continue - break - } - if i < TRY_COUNT-1 { - time.Sleep(RETRY_PAUSE) - } + err := j.getNonce() + if err != nil { + return nonce, err } } if len(j.nonces) == 0 { return "", errors.New("Can't get nonce") } - nonce, j.nonces = j.nonces[len(j.nonces)-1], j.nonces[:len(j.nonces)-1] return nonce, nil }