From f60fe854d59970a654f470502f8adafad370e03b Mon Sep 17 00:00:00 2001 From: Samuel Vazquez Date: Tue, 13 Aug 2024 12:25:47 -0700 Subject: [PATCH] Revert "feat(servers): move execution out of reactor netty threads (#1943)" This reverts commit 78382687050ed64e49c3e3faed63ee1454822561. --- .../graphql/server/execution/GraphQLServer.kt | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/servers/graphql-kotlin-server/src/main/kotlin/com/expediagroup/graphql/server/execution/GraphQLServer.kt b/servers/graphql-kotlin-server/src/main/kotlin/com/expediagroup/graphql/server/execution/GraphQLServer.kt index 59e5b498f0..43d80159be 100644 --- a/servers/graphql-kotlin-server/src/main/kotlin/com/expediagroup/graphql/server/execution/GraphQLServer.kt +++ b/servers/graphql-kotlin-server/src/main/kotlin/com/expediagroup/graphql/server/execution/GraphQLServer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024 Expedia, Inc + * Copyright 2022 Expedia, Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,8 @@ import com.expediagroup.graphql.generator.extensions.plus import com.expediagroup.graphql.server.types.GraphQLResponse import com.expediagroup.graphql.server.types.GraphQLServerResponse import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.coroutineScope -import kotlinx.coroutines.withContext import kotlin.coroutines.CoroutineContext import kotlin.coroutines.EmptyCoroutineContext @@ -50,20 +48,18 @@ open class GraphQLServer( ): GraphQLServerResponse? = coroutineScope { requestParser.parseRequest(request)?.let { graphQLRequest -> - withContext(Dispatchers.Default) { - val graphQLContext = contextFactory.generateContext(request) + val graphQLContext = contextFactory.generateContext(request) - val customCoroutineContext = (graphQLContext.get() ?: EmptyCoroutineContext) - val graphQLExecutionScope = CoroutineScope( - coroutineContext + customCoroutineContext + SupervisorJob() - ) + val customCoroutineContext = (graphQLContext.get() ?: EmptyCoroutineContext) + val graphQLExecutionScope = CoroutineScope( + coroutineContext + customCoroutineContext + SupervisorJob() + ) - val graphQLContextWithCoroutineScope = graphQLContext + mapOf( - CoroutineScope::class to graphQLExecutionScope - ) + val graphQLContextWithCoroutineScope = graphQLContext + mapOf( + CoroutineScope::class to graphQLExecutionScope + ) - requestHandler.executeRequest(graphQLRequest, graphQLContextWithCoroutineScope) - } + requestHandler.executeRequest(graphQLRequest, graphQLContextWithCoroutineScope) } } }