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

fix bug & some optimize #131

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

fix bug & some optimize #131

wants to merge 4 commits into from

Conversation

Panlq
Copy link

@Panlq Panlq commented Apr 6, 2022

  1. add unit tests TestHTTPClientGetRetriesOnTimeout
  2. fix issue Retrier called even with 0 retry count #89/fix: do not wait on zero retries #94: retrier called even with 0 retry count and time sleep will be called even when the retries are exhausted
  3. Cancel the retry sleep if the request context is canceled or the deadline exceeded

some proposal:

  1. an interface or option through which we can customize the retry policy (check error check resp.StatusCode)
  2. some times, we need to know the number of retries and responses when the retrier called. Is any idea about this?
    I implemented a version using the existing method, but it was not very good get the retry times
type Plugin interface {
	OnRequestStart(*http.Request)
	OnRequestEnd(*http.Request, *http.Response)
	// the response struct contains the request. add a attempt num when the err handler?
	OnError(*http.Response, error, int)   
}

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.

None yet

1 participant