Skip to content

Feature/183 refactor abstract http servlet #217

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

Merged
merged 28 commits into from
Nov 28, 2019

Conversation

oliemansm
Copy link
Member

@oliemansm oliemansm commented Nov 15, 2019

@jmccaull @drupalspring
First step in refactoring the servlet. Any comments/contributions are appreciated.

@oliemansm oliemansm added this to the 9.0.0 milestone Nov 15, 2019
@jmccaull
Copy link
Contributor

I can't deep dive into it until Monday but after a quick read I like the direction

// List<ExecutionInput> executionIds = batchedInvocationInput.stream()
// .map(GraphQLSingleInvocationInput::getExecutionInput)
// .collect(Collectors.toList());
// Supplier<Instrumentation> configuredInstrumentation = contextSetting
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmccaull I've created a separate GraphQLBuilder to create the GraphQL object to run the queries against. I thought it would improve performance if you'd just create that once instead of on every query. This is the only part though that I couldn't easily refactor. Any thoughts on this?

I'm also working on a webflux starter, which means we'd have to support a CompletableFuture result for batches too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been a while since we did any profiling, I don't remember this showing up at all as a hotspot or anything. The documentation on the GraphQl object states "Building this object is very cheap and can be done on each execution if necessary...". That being said reusing it would be nice, cheap is relative and documentation gets outdated. It would certainly remove a lot of complexity from invoking a query too.
What I see making this hard to refactor is the instrumentation - I wrote it around the object being recreated for each execution while trying to reuse as much of the original dispatch code as possible, that seems like a mistake from this perspective. The behavior for each context settings is so different would it make sense to create a separate invoker for each? It seems like the request scoped logic would need a handle not only to the GraphQl object but to the instrumentation as well to set it up for each request. At that point too it is probably worth revisiting the tracking approach abstraction, maybe making two distinct instrumentations.
Let me know if you want any help with the lift, etc. It seems like a fairly large one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to create it on the fly anyway, but still refactoring it a bit.

@oliemansm oliemansm merged commit 4d34b40 into master Nov 28, 2019
@oliemansm oliemansm deleted the feature/183-refactor-abstract-http-servlet branch May 11, 2023 17:26
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.

2 participants