build(deps): bump cloud.google.com/go/storage from 1.16.1 to 1.18.1

Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.16.1 to 1.18.1.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/storage/v1.16.1...storage/v1.18.1)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2021-10-18 04:42:23 +00:00 committed by Tom Gundersen
parent 51024c482d
commit 9075dbc61d
79 changed files with 4237 additions and 1468 deletions

View file

@ -32,8 +32,6 @@ import (
"strings"
"sync"
"time"
"github.com/googleapis/gax-go/v2"
)
const (
@ -317,7 +315,7 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) {
code = res.StatusCode
}
if delay, shouldRetry := retryer.Retry(code, reqErr); shouldRetry {
if err := gax.Sleep(ctx, delay); err != nil {
if err := sleep(ctx, delay); err != nil {
return "", "", err
}
continue

View file

@ -15,11 +15,11 @@
package metadata
import (
"context"
"io"
"math/rand"
"net/http"
"time"
"github.com/googleapis/gax-go/v2"
)
const (
@ -30,8 +30,41 @@ var (
syscallRetryable = func(err error) bool { return false }
)
// defaultBackoff is basically equivalent to gax.Backoff without the need for
// the dependency.
type defaultBackoff struct {
max time.Duration
mul float64
cur time.Duration
}
func (b *defaultBackoff) Pause() time.Duration {
d := time.Duration(1 + rand.Int63n(int64(b.cur)))
b.cur = time.Duration(float64(b.cur) * b.mul)
if b.cur > b.max {
b.cur = b.max
}
return d
}
// sleep is the equivalent of gax.Sleep without the need for the dependency.
func sleep(ctx context.Context, d time.Duration) error {
t := time.NewTimer(d)
select {
case <-ctx.Done():
t.Stop()
return ctx.Err()
case <-t.C:
return nil
}
}
func newRetryer() *metadataRetryer {
return &metadataRetryer{bo: &gax.Backoff{Initial: 100 * time.Millisecond}}
return &metadataRetryer{bo: &defaultBackoff{
cur: 100 * time.Millisecond,
max: 30 * time.Second,
mul: 2,
}}
}
type backoff interface {