Skip to content

Commit

Permalink
Revert "feat(servers): move execution out of reactor netty threads" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelAndalon committed Aug 13, 2024
1 parent 2391e2f commit 784461d
Showing 1 changed file with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand All @@ -50,20 +48,18 @@ open class GraphQLServer<Request>(
): GraphQLServerResponse? =
coroutineScope {
requestParser.parseRequest(request)?.let { graphQLRequest ->
withContext(Dispatchers.Default) {
val graphQLContext = contextFactory.generateContext(request)
val graphQLContext = contextFactory.generateContext(request)

val customCoroutineContext = (graphQLContext.get<CoroutineContext>() ?: EmptyCoroutineContext)
val graphQLExecutionScope = CoroutineScope(
coroutineContext + customCoroutineContext + SupervisorJob()
)
val customCoroutineContext = (graphQLContext.get<CoroutineContext>() ?: 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)
}
}
}

0 comments on commit 784461d

Please sign in to comment.