Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/crypto/acme: Client.GetAuthorization should return also Retry-After value #22457

Closed
tnozicka opened this issue Oct 26, 2017 · 5 comments
Closed

Comments

@tnozicka
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.1 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tnozicka/go"
GORACE=""
GOROOT="/home/tnozicka/lib/go"
GOTOOLDIR="/home/tnozicka/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build118198130=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

Request

This function

https://github.com/golang/crypto/blob/541b9d50ad47e36efd8fb423e938e59ff1691f68/acme/acme.go#L355-L369

should return Retry-After as is used in

https://github.com/golang/crypto/blob/541b9d50ad47e36efd8fb423e938e59ff1691f68/acme/acme.go#L415

or there should be similar function that does return it.

I have a work queue and want to know at what time should I re-queue my object and I can't use active waiting as with the former function.

@gopherbot gopherbot added this to the Unreleased milestone Oct 26, 2017
@x1ddos
Copy link

x1ddos commented Nov 3, 2017

@tnozicka how would you propose for GetAuthorization method to return the retry-after value?

@tnozicka
Copy link
Author

tnozicka commented Nov 3, 2017

@x1ddos A) seems nice but I don't really care that much except for having the value available

A) Extend Authorization struct (there is already Status inside)

type Authorization struct {
    // ...
    RetryAfter *time.Duration
}

B) Change return type

func (c *Client) GetAuthorization(ctx context.Context, url string) (*Authorization, error) {/* ... */}
// to
func (c *Client) GetAuthorization(ctx context.Context, url string) (*Authorization, retryAfter time.Duration, error) {/* ... */}

C) Second function if you want to avoid API change

func (c *Client) GetAuthorizationWithRetryTime(ctx context.Context, url string) (*Authorization, retryAfter time.Duration, error) {
    /* ... */
}

func (c *Client) GetAuthorization(ctx context.Context, url string) (*Authorization, error) {
    a, _, err := GetAuthorizationWithRetryTime(ctx, url)
    return a, err
}

@gopherbot
Copy link

Change https://golang.org/cl/109615 mentions this issue: acme: clarify retries and backoff algorithm

gopherbot pushed a commit to golang/crypto that referenced this issue Jun 2, 2018
There's been some confusion about failed request retries.
Rightfully so: some requests are retried, others are not.

This change attempts to clarify the issue and unify backoff
usage in all Client's methods by introducing a new exported
optional field RetryBackoff and adding retry logic where missing.

Also, updates golang/go#22457.

Change-Id: Ied434edf998d52925a48b6b3b2407d45a6e9d2ee
Reviewed-on: https://go-review.googlesource.com/109615
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@x1ddos
Copy link

x1ddos commented Jun 2, 2018

@tnozicka acme.Client now has RetryBackoff field, which should allow for both access to Retry-After and have your own implementation of a retry backoff in methods like WaitAuthorization.

Would you now consider this issue fixed?

@andybons andybons changed the title x/crypto acme.Client.GetAuthorization should return also Retry-After value x/crypto/acme: Client.GetAuthorization should return also Retry-After value May 14, 2019
@andybons
Copy link
Member

Closing since no response from original reporter.

@golang golang locked and limited conversation to collaborators May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants