But I think that usage might be broken. Backoff will only retry on grpc error codes that are retriable, plus the RetriableError struct. The GetRawEntries call I linked to is implemented by jsonclient.GetAndParse, which returns RspErrors. Those RspErrors don't match any of the conditions for retries.
I'd like to propose this: In addition to / instead of backoff.RetriableError, the backoff package should check for some interface, e.g. Retryable() bool. Then jsonclient.RspError can implement Retryable() as: a RspError is retryable if its wrapped error is a net.Timeout error OR the HTTP status code is >500.
I'm working on a tool that uses fetcher.go, and also calls GetProofByHash. I'd like to configure it to do backoffs and retries. I see that fetcher.go uses a
Backoff
struct provided internally:https://github.com/google/certificate-transparency-go/blob/6ecca400d5e42ae3f26ad5c27cea9f907474024d/scanner/fetcher.go#L273-L292
But I think that usage might be broken.
Backoff
will only retry on grpc error codes that are retriable, plus theRetriableError
struct. The GetRawEntries call I linked to is implemented byjsonclient.GetAndParse
, which returns RspErrors. Those RspErrors don't match any of the conditions for retries.I'd like to propose this: In addition to / instead of backoff.RetriableError, the backoff package should check for some interface, e.g.
Retryable() bool
. Thenjsonclient.RspError
can implementRetryable()
as: a RspError is retryable if its wrapped error is a net.Timeout error OR the HTTP status code is >500.What do you think?