Skip to content

Commit

Permalink
gcs: add config to disable retries
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwanth Goli <[email protected]>
  • Loading branch information
ashwanthgoli committed Oct 10, 2024
1 parent 8897e65 commit 3abd692
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions providers/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type Config struct {
// Used as storage.Writer.ChunkSize of https://pkg.go.dev/google.golang.org/cloud/storage#Writer
ChunkSizeBytes int `yaml:"chunk_size_bytes"`
noAuth bool `yaml:"no_auth"`

// gcs client retries idempotent operations by default, this option disables retries.
DisableRetries bool `yaml:"disable_retries"`
}

// Bucket implements the store.Bucket and shipper.Bucket interfaces against GCS.
Expand Down Expand Up @@ -172,6 +175,11 @@ func newBucket(ctx context.Context, logger log.Logger, gc Config, opts []option.
name: gc.Bucket,
chunkSize: gc.ChunkSizeBytes,
}

if gc.DisableRetries {
bkt.bkt = bkt.bkt.Retryer(storage.WithPolicy(storage.RetryNever))
}

return bkt, nil
}

Expand Down

0 comments on commit 3abd692

Please sign in to comment.