-
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
Push RequestContext tolerance into ConcurrencyStrategy #951
Conversation
NetflixOSS » Hystrix » Hystrix-pull-requests #219 SUCCESS |
} catch (IllegalStateException ise) { | ||
//expected | ||
} | ||
assertNull(HystrixRequestLog.getCurrentRequest()); |
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'd been hoping to avoid changing any tests but the use of this same method call in command instantiation precludes that option without more logical changes.
In terms of possibly blowing up more intelligently I would maybe create a |
Thanks @mwhipple. I'm going to try to summarize your changes, to make sure I understand what you've done and the implications. Please correct anything I get wrong. There are 4 cases:
I've added unit tests in #953 that demonstrate the custom concurrency cases. In master without your PR, the situation is as follows:
After your PR:
If I'm interpreting this correctly, this basically drops the distinction between custom and default concurrency strategies. The only important bit is if the request context has been initialized. If it has been, then objects that need request-scoped access (like On the compatibility side, I think this should never change the result of any method call that was already returning a value. It will now return a null instead of throwing an
The 3 method calls that were throwing exceptions in #953 all return null instead with your change. The downside to this change is that the immediate feedback of the This is also the upside, as it allows forward progress when request log is only enabled by default, and your custom concurrency strategy doesn't care about request context, and you've not initialized it. On balance, this seems like a good change and a good opportunity to document all of the above. Anything I missed, @mwhipple / @amitcse / @ruhkopf / @benjchristensen ? |
That all sounds right. Removing the distinction from the default strategy and a custom one was one of the motivations so that the default strategy could serve as more of a direct template for custom implementations without lurking variations in behavior. A potentially significant implied variable in the scenarios outlined above is the Thanks |
@mwhipple Yeah, the last issue you brought up has come up in a few threads (#92 / #724 / #718). In order to use a custom concurrency strategy and not initialize the context, the only solution was to explicitly turn off the request log. And that's a pretty hacky solution. So I think this PR looks good, but I will give others a chance to weigh in. If I don't hear anything negative by the EOD, I'll merge. Thanks for this, @mwhipple |
Push RequestContext tolerance into ConcurrencyStrategy
Thanks @mwhipple ! |
…ency-strategy-fix Fix test assertions after fixes in #951
Design change as mentioned in #92