@@ -19,10 +19,8 @@ package com.expediagroup.graphql.server.execution
1919import com.expediagroup.graphql.server.types.GraphQLResponse
2020import com.expediagroup.graphql.server.types.GraphQLServerResponse
2121import kotlinx.coroutines.CoroutineScope
22- import kotlinx.coroutines.Dispatchers
2322import kotlinx.coroutines.SupervisorJob
2423import kotlinx.coroutines.coroutineScope
25- import kotlinx.coroutines.withContext
2624import kotlin.coroutines.CoroutineContext
2725import kotlin.coroutines.EmptyCoroutineContext
2826
@@ -48,21 +46,19 @@ open class GraphQLServer<Request>(
4846 ): GraphQLServerResponse ? =
4947 coroutineScope {
5048 requestParser.parseRequest(request)?.let { graphQLRequest ->
51- withContext(Dispatchers .Default ) {
52- val deprecatedContext = contextFactory.generateContext(request)
53- val contextMap = contextFactory.generateContextMap(request)
49+ val deprecatedContext = contextFactory.generateContext(request)
50+ val contextMap = contextFactory.generateContextMap(request)
5451
55- val customCoroutineContext = (deprecatedContext?.graphQLCoroutineContext() ? : EmptyCoroutineContext ) +
56- (contextMap[CoroutineContext ::class ] as ? CoroutineContext ? : EmptyCoroutineContext )
57- val graphQLExecutionScope = CoroutineScope (
58- coroutineContext + customCoroutineContext + SupervisorJob ()
59- )
60- val graphQLContext = contextMap + mapOf (
61- CoroutineScope ::class to graphQLExecutionScope
62- )
52+ val customCoroutineContext = (deprecatedContext?.graphQLCoroutineContext() ? : EmptyCoroutineContext ) +
53+ (contextMap[CoroutineContext ::class ] as ? CoroutineContext ? : EmptyCoroutineContext )
54+ val graphQLExecutionScope = CoroutineScope (
55+ coroutineContext + customCoroutineContext + SupervisorJob ()
56+ )
57+ val graphQLContext = contextMap + mapOf (
58+ CoroutineScope ::class to graphQLExecutionScope
59+ )
6360
64- requestHandler.executeRequest(graphQLRequest, deprecatedContext, graphQLContext)
65- }
61+ requestHandler.executeRequest(graphQLRequest, deprecatedContext, graphQLContext)
6662 }
6763 }
6864}
0 commit comments