"git.arvados.org/arvados.git/sdk/go/httpserver"
"github.com/hashicorp/go-retryablehttp"
+ "github.com/sirupsen/logrus"
)
// A Client is an HTTP client with an API endpoint and a set of
// context deadline to establish a maximum request time.
Timeout time.Duration
+ // Maximum disk cache size in bytes or percent of total
+ // filesystem size. If zero, use default, currently 10% of
+ // filesystem size.
+ DiskCacheSize ByteSizeOrPercent
+
+ // Where to write debug logs. May be nil.
+ Logger logrus.FieldLogger
+
dd *DiscoveryDocument
defaultRequestID string
APIHost: ctrlURL.Host,
Insecure: cluster.TLS.Insecure,
Timeout: 5 * time.Minute,
+ DiskCacheSize: cluster.Collections.WebDAVCache.DiskCacheSize,
requestLimiter: &requestLimiter{maxlimit: int64(cluster.API.MaxConcurrentRequests / 4)},
}, nil
}
var nopCancelFunc context.CancelFunc = func() {}
-var reqErrorRe = regexp.MustCompile(`net/http: invalid header `)
-
// Do augments (*http.Client)Do(): adds Authorization and X-Request-Id
// headers, delays in order to comply with rate-limiting restrictions,
// and retries failed requests when appropriate.
if c.Timeout == 0 {
return false, nil
}
- if respErr != nil && reqErrorRe.MatchString(respErr.Error()) {
- return false, nil
- }
retrying, err := retryablehttp.DefaultRetryPolicy(ctx, resp, respErr)
if retrying {
lastResp, lastRespBody, lastErr = resp, nil, respErr