-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Updates HystrixCommand to expose an isCommandTimedOut() method. #144
Conversation
Updates HystrixCommand to expose an isCommandTimedOut() method, which can be helpful when determining what to do inside of getFallback().
This would be very helpful to work that I'm doing. Since the other two booleans are exposed, it seems like this would be safe to add. |
Hystrix-pull-requests #17 FAILURE |
What are you trying to accomplish that isn't offered by this existing method? /**
* Whether the response received was the result of a timeout
* and <code>getFallback()</code> being called.
*
* @return boolean
*/
public boolean isResponseTimedOut() {
return executionResult.events.contains(HystrixEventType.TIMEOUT);
} |
* | ||
* @return boolean | ||
*/ | ||
public boolean isFailedExecution() { |
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 assume it's a mistake that this change deletes the isFailedExecution
method?
Hystrix-pull-requests #18 FAILURE |
Oh lord, that's terrible. I used the GH editor and I guess I pasted over it. Sorry, fixed now. Though it looks like maybe there are unrelated build failures from master? |
@benjchristensen isResponseTimedOut() seems to return false from inside of getFallback(), so I assumed it refers to the response after the fallback is processed. |
I think this just means we should fix the existing method rather than adding another that is basically a duplicate. Can you provide a unit test that shows isResponseTimedOut() returning false inside getFallback() when run() timed-out? |
Sure thing. If that is the expected behavior then here is a small failing test: UnquietCode@a300d93 (it's on it's own branch: https://github.com/UnquietCode/Hystrix/branches/unquietcode_pull_144) |
Thank you @UnquietCode for this report and the unit test. I have merged your test and implemented a fix that exposes not just timeout but any failure state to the |
Fixes Netflix#144 reported by @UnquietCode with a unit test demonstrating the issue.
Updates HystrixCommand to expose an isCommandTimedOut() method, which can be helpful when determining what to do inside of getFallback().