Skip to content

Reuse schema generator for tests #641

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

Closed
wants to merge 6 commits into from

Conversation

smyrick
Copy link
Contributor

@smyrick smyrick commented Mar 18, 2020

📝 Description

In an effort to save memory and build time, I made a common testGenerator that just uses the basic SchemaGeneratorConfig we already we using. Previously, every call to toSchema would create a new SchemaGenerator class which creates a new type cache and class scanner. Maybe this will help with the Github actions out of memory issues?

🔗 Related Issues

@smyrick smyrick added changes: patch Changes require a patch version type: refactor Code changes that have no impact on users labels Mar 18, 2020
@@ -67,7 +67,7 @@ open class SchemaGenerator(internal val config: SchemaGeneratorConfig) {
builder.codeRegistry(codeRegistry.build())
val schema = config.hooks.willBuildSchema(builder).build()

classScanner.close()
Copy link
Contributor Author

@smyrick smyrick Mar 18, 2020

Choose a reason for hiding this comment

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

This will be closed automatically when the schema generator is removed by GC

Copy link
Collaborator

Choose a reason for hiding this comment

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

i'd still explicitly close it just in case

Copy link
Collaborator

Choose a reason for hiding this comment

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

since ScanResult implements Closeable we could use Kotlin use (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/use.html)

Copy link
Collaborator

@dariuszkuc dariuszkuc left a comment

Choose a reason for hiding this comment

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

LGTM

@smyrick
Copy link
Contributor Author

smyrick commented Mar 19, 2020

I have no idea why these checks are not failing for me locally. I keep running a build on java 11 but it is always passing for me

Shane Myrick added 3 commits March 19, 2020 11:29
In an effort to save memory and build time, I made a common testGenerator that just uses the basic SchemaGeneratorConfig we already we using. Previously, every call to toSchema would create a new SchemaGenerator class which creates a new type cache and class scanner. Maybe this will help with the Github actions?
@smyrick smyrick force-pushed the reuse-schema-generator branch from def109b to ce6360b Compare March 19, 2020 18:43
smyrick pushed a commit to smyrick/graphql-kotlin that referenced this pull request Mar 19, 2020
Extracting separate changes from ExpediaGroup#641 that cleans up the resources used when creating a new schema generator. Hopefully this will help with our unit test out of memory issues
@smyrick
Copy link
Contributor Author

smyrick commented Mar 19, 2020

Closing in favor of #643

@smyrick smyrick closed this Mar 19, 2020
@smyrick smyrick deleted the reuse-schema-generator branch March 19, 2020 19:50
dariuszkuc pushed a commit that referenced this pull request Mar 20, 2020
Extracting separate changes from #641 that cleans up the resources used when creating a new schema generator. Hopefully this will help with our unit test out of memory issues

Co-authored-by: Shane Myrick <[email protected]>
dariuszkuc pushed a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
Extracting separate changes from ExpediaGroup#641 that cleans up the resources used when creating a new schema generator. Hopefully this will help with our unit test out of memory issues

Co-authored-by: Shane Myrick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: patch Changes require a patch version type: refactor Code changes that have no impact on users
Development

Successfully merging this pull request may close these issues.

2 participants