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

Make RetryIfFunc handle request errors #1818

Merged
merged 5 commits into from
Aug 25, 2024

Conversation

ksw2000
Copy link
Contributor

@ksw2000 ksw2000 commented Aug 5, 2024

Fix #1744
To maintain compatibility with the previous RetryIfFunc as much as possible, I think it can be relaxed into an interface{} type.
I believe that directly adding an extra field might confuse developers.
If we were to directly use generics introduced in Go 1.18 for type constraints, it would involve too many changes.
I think the most balanced approach for now is to handle it using interface{} and type assertion.

Copy link
Collaborator

@erikdubbelboer erikdubbelboer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been thinking about this, and I think it's too much of a backwards incompatible change also also makes it less clear on how to use it. I would suggest we add a RetryIfError func(request *Request) bool and mark RetryIf as deprecated.

@ksw2000 ksw2000 changed the title Try to make RetryIfFunc handle request errors #1744 Make RetryIfFunc handle request errors Aug 25, 2024
@erikdubbelboer erikdubbelboer merged commit 25c52d7 into valyala:master Aug 25, 2024
15 checks passed
@erikdubbelboer
Copy link
Collaborator

Thanks!

@ksw2000
Copy link
Contributor Author

ksw2000 commented Aug 25, 2024

Oops, I found that I only added the new field for HostClient but not for Client.

@erikdubbelboer what should I do? Create a new PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Propagate request error to RetryIfFunc
2 participants