@@ -19,10 +19,8 @@ package com.expediagroup.graphql.server.execution
19
19
import com.expediagroup.graphql.server.types.GraphQLResponse
20
20
import com.expediagroup.graphql.server.types.GraphQLServerResponse
21
21
import kotlinx.coroutines.CoroutineScope
22
- import kotlinx.coroutines.Dispatchers
23
22
import kotlinx.coroutines.SupervisorJob
24
23
import kotlinx.coroutines.coroutineScope
25
- import kotlinx.coroutines.withContext
26
24
import kotlin.coroutines.CoroutineContext
27
25
import kotlin.coroutines.EmptyCoroutineContext
28
26
@@ -48,21 +46,19 @@ open class GraphQLServer<Request>(
48
46
): GraphQLServerResponse ? =
49
47
coroutineScope {
50
48
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)
54
51
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
+ )
63
60
64
- requestHandler.executeRequest(graphQLRequest, deprecatedContext, graphQLContext)
65
- }
61
+ requestHandler.executeRequest(graphQLRequest, deprecatedContext, graphQLContext)
66
62
}
67
63
}
68
64
}
0 commit comments