-
Notifications
You must be signed in to change notification settings - Fork 25k
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
RestController not using thread context directly from thread pool #74293
RestController not using thread context directly from thread pool #74293
Conversation
At the moment thread context is passed via dispatchRequest but in some places thread context is fetched directly from thread pool This is not a problem in production, because thread pool is initialized with the same thread context as the one passed to dispatchRequest via AbstractHttpServerTransport. It might be harder to understand though and might cause problems in testing in smaller units.
Pinging @elastic/es-core-infra (Team:Core/Infra) |
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.
LGTM, though I'd like if we reverted unrelated test changes (they're nice but should go into a separate PR IMO) :)
.build(); | ||
dispatchRequest(request); | ||
assertWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE); | ||
for (RestRequest.Method method : Arrays.asList(RestRequest.Method.GET, RestRequest.Method.HEAD)) { |
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.
These test changes while nice aren't really related to the rest of the PR, maybe revert those to keep the change isolated?
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.
good idea, I will revert the test cases and will follow up in a separate PR
…astic#74293) At the moment thread context is passed via dispatchRequest but in some places thread context is fetched directly from thread pool This is not a problem in production, because thread pool is initialized with the same thread context as the one passed to dispatchRequest via AbstractHttpServerTransport. It might be harder to understand though and might cause problems in testing in smaller units.
Refactoring RestGetActionTests and RestGestSourceActionTests to remove duplicated code. Previously the tests would fail if rest request was sent twice to RestController. This was fixed in elastic#74293 and the refactoring is possible now
…kport(#74293) #74488 At the moment thread context is passed via dispatchRequest but in some places thread context is fetched directly from thread pool This is not a problem in production, because thread pool is initialized with the same thread context as the one passed to dispatchRequest via AbstractHttpServerTransport. It might be harder to understand though and might cause problems in testing in smaller units. backports #74293
Refactoring RestGetActionTests and RestGestSourceActionTests to remove duplicated code. Previously the tests would fail if rest request was sent twice to RestController. This was fixed in #74293 and the refactoring is possible now
At the moment thread context is passed via dispatchRequest but in some
places thread context is fetched directly from thread pool
This is not a problem in production, because thread pool is initialized
with the same thread context as the one passed to dispatchRequest via
AbstractHttpServerTransport.
It might be harder to understand though and might cause problems in
testing in smaller units.
relates #74230 (comment)