From 3abd692dc442003a475b688f63a4b75005438aaf Mon Sep 17 00:00:00 2001 From: Ashwanth Goli Date: Thu, 10 Oct 2024 19:01:49 +0530 Subject: [PATCH] gcs: add config to disable retries Signed-off-by: Ashwanth Goli --- providers/gcs/gcs.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/providers/gcs/gcs.go b/providers/gcs/gcs.go index b5dae200..0a5d89df 100644 --- a/providers/gcs/gcs.go +++ b/providers/gcs/gcs.go @@ -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. @@ -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 }