11/*
2- * Copyright 2024 Expedia, Inc
2+ * Copyright 2022 Expedia, Inc
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -21,10 +21,8 @@ import com.expediagroup.graphql.generator.extensions.plus
2121import com.expediagroup.graphql.server.types.GraphQLResponse
2222import com.expediagroup.graphql.server.types.GraphQLServerResponse
2323import kotlinx.coroutines.CoroutineScope
24- import kotlinx.coroutines.Dispatchers
2524import kotlinx.coroutines.SupervisorJob
2625import kotlinx.coroutines.coroutineScope
27- import kotlinx.coroutines.withContext
2826import kotlin.coroutines.CoroutineContext
2927import kotlin.coroutines.EmptyCoroutineContext
3028
@@ -50,20 +48,18 @@ open class GraphQLServer<Request>(
5048 ): GraphQLServerResponse ? =
5149 coroutineScope {
5250 requestParser.parseRequest(request)?.let { graphQLRequest ->
53- withContext(Dispatchers .Default ) {
54- val graphQLContext = contextFactory.generateContext(request)
51+ val graphQLContext = contextFactory.generateContext(request)
5552
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+ )
6057
61- val graphQLContextWithCoroutineScope = graphQLContext + mapOf (
62- CoroutineScope ::class to graphQLExecutionScope
63- )
58+ val graphQLContextWithCoroutineScope = graphQLContext + mapOf (
59+ CoroutineScope ::class to graphQLExecutionScope
60+ )
6461
65- requestHandler.executeRequest(graphQLRequest, graphQLContextWithCoroutineScope)
66- }
62+ requestHandler.executeRequest(graphQLRequest, graphQLContextWithCoroutineScope)
6763 }
6864 }
6965}
0 commit comments