Skip to content

Commit

Permalink
fix: remove retry in read as retry for create/update is already handl…
Browse files Browse the repository at this point in the history
…ed in respective methods (GoogleCloudPlatform#12028)
  • Loading branch information
gurusai-voleti authored and kyle mathews committed Nov 13, 2024
1 parent d405c51 commit 2eb945e
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -961,18 +961,9 @@ func resourceStorageBucketRead(d *schema.ResourceData, meta interface{}) error {
// Get the bucket and acl
bucket := d.Get("name").(string)

var res *storage.Bucket
// There seems to be some eventual consistency errors in some cases, so we want to check a few times
// to make sure it exists before moving on
err = transport_tpg.Retry(transport_tpg.RetryOptions{
RetryFunc: func() (operr error) {
var retryErr error
res, retryErr = config.NewStorageClient(userAgent).Buckets.Get(bucket).Do()
return retryErr
},
Timeout: d.Timeout(schema.TimeoutRead),
ErrorRetryPredicates: []transport_tpg.RetryErrorPredicateFunc{transport_tpg.IsNotFoundRetryableError("bucket read")},
})
res, err := config.NewStorageClient(userAgent).Buckets.Get(bucket).Do()

if err != nil {
return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("Storage Bucket %q", d.Get("name").(string)))
Expand Down

0 comments on commit 2eb945e

Please sign in to comment.