dave08
02/23/2023, 2:49 PM5
2023-02-23 14:45:43.454 [DefaultDispatcher-worker-2] INFO ktor.application - prewait delay of 30000ms, turn it off using io.ktor.development=true
4
2023-02-23 14:46:13.455 [DefaultDispatcher-worker-2] INFO ktor.application - Shutting down HTTP server...
3
2023-02-23 14:46:13.962 [DefaultDispatcher-worker-2] INFO ktor.application - Application stopping: io.ktor.server.application.Application@6da73151
2
2023-02-23 14:46:13.963 [DefaultDispatcher-worker-2] INFO ktor.application - Application stopped: io.ktor.server.application.Application@6da73151
1
2023-02-23 14:46:13.966 [DefaultDispatcher-worker-2] INFO ktor.application - HTTP server shutdown!
right after Ktor was already ready to receive connections! Why is it closing down like that?simon.vergauwen
02/23/2023, 3:00 PMawaitCancellation
of the SuspendApp
.
https://github.com/nomisRev/ktor-arrow-example/blob/efb93311e4a0d2db47ecb1c134e0ec0f922d7d2d/src/main/kotlin/io/github/nomisrev/main.kt#L21
Similarly to how you would otherwise call start(wait = true)
.dave08
02/23/2023, 3:00 PMfun main() = SuspendApp {
resourceScope {
val appConfigs = getAppConfig {
addResourceSource("/application.yml")
addResourceSource("/application-dev.yml", true)
addEnvironmentSource()
}
val appResources = appResources(appConfigs)
server(
Netty, port = 8080, host = "0.0.0.0",
module = AppComponent::class.create(appResources, appConfigs).appModule
)
}
awaitCancellation()
}
simon.vergauwen
02/23/2023, 3:01 PMresourceScope
so the resourceScope
and thus the server
terminates.dave08
02/23/2023, 3:02 PM