From a90bd8c0b0f45da0b5caf232bf364b3fd0c9d003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Oliver=20S=C3=B8berg?= Date: Fri, 18 Oct 2024 10:41:53 +0200 Subject: [PATCH] Svelg redeploy exceptions --- .../kotlin/initialisering/EmbeddedServerConfig.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/etterlatte-ktor/src/main/kotlin/initialisering/EmbeddedServerConfig.kt b/libs/etterlatte-ktor/src/main/kotlin/initialisering/EmbeddedServerConfig.kt index 57d7b4020c0..d7d27babb04 100644 --- a/libs/etterlatte-ktor/src/main/kotlin/initialisering/EmbeddedServerConfig.kt +++ b/libs/etterlatte-ktor/src/main/kotlin/initialisering/EmbeddedServerConfig.kt @@ -19,6 +19,9 @@ import no.nav.etterlatte.libs.ktor.healthApi import no.nav.etterlatte.libs.ktor.ktor.shutdownPolicyEmbeddedServer import no.nav.etterlatte.libs.ktor.metricsRoute import no.nav.etterlatte.libs.ktor.restModule +import no.nav.etterlatte.logger +import org.slf4j.LoggerFactory +import kotlin.coroutines.cancellation.CancellationException fun initEmbeddedServer( httpPort: Int, @@ -73,6 +76,12 @@ private fun settOppEmbeddedServer( }, ) +val logger = LoggerFactory.getLogger("CIOApplicationEngine") + fun CIOApplicationEngine.run() { - start(true) + try { + start(true) + } catch (e: CancellationException) { + logger.warn("Appen redeployes mens den kjører opp e.l.", e) + } }