20602: Add IneligibleForQueuePriority const.
[arvados.git] / sdk / go / arvados / client.go
index c4031465034a9e792c46ffbcb5ae1445fbe70230..d71ade8a81f92e76fe0c9155d16e437fb3dbb267 100644 (file)
@@ -374,12 +374,17 @@ func isRedirectStatus(code int) bool {
        }
 }
 
+const minExponentialBackoffBase = time.Second
+
 // Implements retryablehttp.Backoff using the server-provided
 // Retry-After header if available, otherwise nearly-full jitter
 // exponential backoff (similar to
 // https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/),
 // in all cases respecting the provided min and max.
 func exponentialBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration {
+       if attemptNum > 0 && min < minExponentialBackoffBase {
+               min = minExponentialBackoffBase
+       }
        var t time.Duration
        if resp != nil && (resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode == http.StatusServiceUnavailable) {
                if s := resp.Header.Get("Retry-After"); s != "" {
@@ -535,6 +540,12 @@ func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, m
        if err != nil {
                return err
        }
+       if dst == nil {
+               if urlValues == nil {
+                       urlValues = url.Values{}
+               }
+               urlValues["select"] = []string{`["uuid"]`}
+       }
        if urlValues == nil {
                // Nothing to send
        } else if body != nil || ((method == "GET" || method == "HEAD") && len(urlValues.Encode()) < 1000) {