Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: export default shouldRetry function #6362

Closed
miroslavLalev opened this issue Jul 19, 2022 · 1 comment · Fixed by #6370
Closed

storage: export default shouldRetry function #6362

miroslavLalev opened this issue Jul 19, 2022 · 1 comment · Fixed by #6370
Assignees
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@miroslavLalev
Copy link

I've recently stumbled across similar errors to #3735 and applied the proposed fix there - created a new ShouldRetry function for the storage client. However, it seems very odd that I have to copy the code from the default retry function - which also means that any additions/fixes to it will not be reflected in my code automatically. I think it would be nice to have that function exported from the storage package, so it can be used like that:

gcsClient.SetRetry(storage.WithErrorFunc(func(err error) bool {
	if storage.DefaultShouldRetry(err) { // this function comes from the storage package
		return true
	}
	return customShouldRetry(err) // my custom retry logic
}))
@miroslavLalev miroslavLalev added the triage me I really want to be triaged. label Jul 19, 2022
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 19, 2022
@ddelgrosso1 ddelgrosso1 added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Jul 19, 2022
@tritone
Copy link
Contributor

tritone commented Jul 19, 2022

Thanks for the FR. I think this is a reasonable suggestion given that the updates we made to retry strategy have now been "baked in" for a while, and it will be useful for users to be able to keep up to date with any changes we make to ShouldRetry even while adding custom logic using WithErrorFunc.

I'll make a PR to expose this.

tritone added a commit to tritone/google-cloud-go that referenced this issue Jul 19, 2022
Export the default func to determine whether an error is retryable.
This makes it easier for users to use the WithErrorFunc option
without copying a lot of code.

Fixes googleapis#6362
tritone added a commit to tritone/google-cloud-go that referenced this issue Jul 19, 2022
Export the default func to determine whether an error is retryable.
This makes it easier for users to use the WithErrorFunc option
without copying a lot of code.

Fixes googleapis#6362
tritone added a commit that referenced this issue Aug 11, 2022
Export the default func to determine whether an error is retryable.
This makes it easier for users to use the WithErrorFunc option
without copying a lot of code.

Fixes #6362
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants