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 (#12028) (#19964)

[upstream:0691f56c783fd8de9a7e8240e80179bf14e1559f]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 22, 2024
1 parent 9a4833b commit 89bf464
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/12028.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note: bug
storage: removed retry on 404s during refresh for `google_storage_bucket`, preventing hanging when refreshing deleted buckets
```
11 changes: 1 addition & 10 deletions google/services/storage/resource_storage_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,18 +963,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 89bf464

Please sign in to comment.