-
Notifications
You must be signed in to change notification settings - Fork 665
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
return an error when max retry is reached in executeMethod() #554
Conversation
This is not a bad idea but i think we can return the actual error rather than sending special error like retry. Right now it is sent it is just that DeleteObject() ignores it. You can modify that part of code instead. |
I believe It will return an error on closed connection or empty response, but not on a valid 500. Now I can inspect |
Yes in case of executeMethod() we should save the error regardless of the response codes. |
@@ -528,6 +532,11 @@ func (c Client) executeMethod(method string, metadata requestMetadata) (res *htt | |||
// For all other cases break out of the retry loop. | |||
break | |||
} | |||
|
|||
if retryCount >= MaxRetry { | |||
err = errors.New("Max retry reached") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to declare the error once at the package level, and return that instead.
On the other hand, in this case, would you want to return the last error received? I was thinking if you just return "Max retry reached", the caller won't have any idea what the underlying error was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is what we need here, we should only return the last error after all the retries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said above, the last error is nil in this case, since c.Do()
doesn't return error on 500.
I added an additional check here to make it clear (err == nil
). I verified that this fixes my issue.
I can make another PR to attempt to fix this in RemoveObject()
, but the point still stands this will keep happening for any other calls other than RemoveObject().
daf976a
to
61ddef2
Compare
Created #555 as an alternative approach. |
You can close this @ericychoi |
This approach is no longer needed. Thanks @ericychoi |
DO NOT MERGE, missing tests.