Neal Sanche

12/09/2021, 9:44 PM
I have another question about graphql context factory. Is there a way to know the lifecycle of the produced context? For example I'd like to know when it might be safe to destroy some things that are built as part of the context. Maybe I shouldn't be putting things that need to be cleaned up into the context. I'll keep looking...

Dariusz Kuc

12/09/2021, 9:53 PM
context is created per request

Neal Sanche

12/09/2021, 11:50 PM
Okay, makes sense. I've changed our code so that we don't create things in the context that need to be closed or cleaned up. Just chasing down some memory leaks. Using Ktor to grab a few things and wasn't closing all of the HttpClient instances. We had put an HttpClient into the UserGraphQLContext, and it was leaking because it was never closed. I guess I was just wondering if there was a way to be told when to clean up the context.
Now I just store data in it, so I think we don't need any changes from graphql-kotlin.
👍 1