1
1
/*
2
- * Copyright 2024 Expedia, Inc
2
+ * Copyright 2022 Expedia, Inc
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -21,10 +21,8 @@ import com.expediagroup.graphql.generator.extensions.plus
21
21
import com.expediagroup.graphql.server.types.GraphQLResponse
22
22
import com.expediagroup.graphql.server.types.GraphQLServerResponse
23
23
import kotlinx.coroutines.CoroutineScope
24
- import kotlinx.coroutines.Dispatchers
25
24
import kotlinx.coroutines.SupervisorJob
26
25
import kotlinx.coroutines.coroutineScope
27
- import kotlinx.coroutines.withContext
28
26
import kotlin.coroutines.CoroutineContext
29
27
import kotlin.coroutines.EmptyCoroutineContext
30
28
@@ -50,20 +48,18 @@ open class GraphQLServer<Request>(
50
48
): GraphQLServerResponse ? =
51
49
coroutineScope {
52
50
requestParser.parseRequest(request)?.let { graphQLRequest ->
53
- withContext(Dispatchers .Default ) {
54
- val graphQLContext = contextFactory.generateContext(request)
51
+ val graphQLContext = contextFactory.generateContext(request)
55
52
56
- val customCoroutineContext = (graphQLContext.get<CoroutineContext >() ? : EmptyCoroutineContext )
57
- val graphQLExecutionScope = CoroutineScope (
58
- coroutineContext + customCoroutineContext + SupervisorJob ()
59
- )
53
+ val customCoroutineContext = (graphQLContext.get<CoroutineContext >() ? : EmptyCoroutineContext )
54
+ val graphQLExecutionScope = CoroutineScope (
55
+ coroutineContext + customCoroutineContext + SupervisorJob ()
56
+ )
60
57
61
- val graphQLContextWithCoroutineScope = graphQLContext + mapOf (
62
- CoroutineScope ::class to graphQLExecutionScope
63
- )
58
+ val graphQLContextWithCoroutineScope = graphQLContext + mapOf (
59
+ CoroutineScope ::class to graphQLExecutionScope
60
+ )
64
61
65
- requestHandler.executeRequest(graphQLRequest, graphQLContextWithCoroutineScope)
66
- }
62
+ requestHandler.executeRequest(graphQLRequest, graphQLContextWithCoroutineScope)
67
63
}
68
64
}
69
65
}
0 commit comments