Skip to content

Commit

Permalink
compile: fix few more compiling warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodongw committed Nov 16, 2021
1 parent 0ac1266 commit 9f7b4b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ allprojects {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xuse-experimental=kotlin.Experimental")
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
}
}

Expand Down
8 changes: 2 additions & 6 deletions kert-http/src/main/kotlin/ws/leap/kert/http/HttpRouter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import io.vertx.core.http.HttpMethod
import io.vertx.ext.web.Router
import io.vertx.kotlin.coroutines.await
import io.vertx.kotlin.coroutines.dispatcher
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.*
import kotlinx.coroutines.slf4j.MDCContext
import mu.KotlinLogging
import kotlin.coroutines.AbstractCoroutineContextElement
Expand Down Expand Up @@ -100,13 +97,12 @@ open class HttpRouterBuilder(private val vertx: Vertx,
return context.dispatcher() + VertxRoutingContext(routingContext) + MDCContext() + exceptionHandler()
}

@OptIn(DelicateCoroutinesApi::class)
private fun registerCall(method: HttpMethod, path: String, handler: HttpServerHandler, filter: HttpServerFilter?) {
underlying.route(method, path).handler { routingContext ->
val request = HttpServerRequest(routingContext.request(), routingContext)
val context = Vertx.currentContext()

GlobalScope.launch(createContext(routingContext)) {
CoroutineScope(createContext(routingContext)).launch {
val response = filter?.let { it(request, handler) } ?: handler(request)
val vertxResponse = routingContext.response()

Expand Down

0 comments on commit 9f7b4b2

Please sign in to comment.