Skip to content
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

Add introspection fields during schema creation #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dwwoelfel
Copy link
Contributor

@dwwoelfel dwwoelfel commented Dec 18, 2019

This solves a problem we saw at OneGraph when upgrading to the latest version of ocaml-graphql-server.

Our query times increased by ~60ms on every query after upgrading. We tracked down the cause to this commit b187eaa, which calls types_of_schema on every call to execute. We have a lot of types, so it added a noticeable amount of latency.

With this change, types_of_schema is calculated only once when you construct the schema.

Copy link
Owner

@andreas andreas left a comment

Choose a reason for hiding this comment

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

Thanks for raising this! The patch makes sense, though I have one suggestion (see comment).

}
in
let types = Introspection.types_of_schema schema in
Introspection.add_built_in_fields schema types
Copy link
Owner

Choose a reason for hiding this comment

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

How about leaving add_built_in_fields as is and simply call it from here?

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