From fceb4d304d26608ddaa636914a75d8b007ed67da Mon Sep 17 00:00:00 2001 From: Gustav Berggren Date: Fri, 13 Oct 2023 13:07:23 +0200 Subject: [PATCH] =?UTF-8?q?retry=20p=C3=A5=20flere=20feil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helsearbeidsgiver/inntektsmelding/brospinn/HttpUtils.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bro-spinn/src/main/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/brospinn/HttpUtils.kt b/bro-spinn/src/main/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/brospinn/HttpUtils.kt index b1f657139..4b38a9626 100644 --- a/bro-spinn/src/main/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/brospinn/HttpUtils.kt +++ b/bro-spinn/src/main/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/brospinn/HttpUtils.kt @@ -7,6 +7,9 @@ import io.ktor.client.plugins.HttpRequestRetry import io.ktor.client.plugins.contentnegotiation.ContentNegotiation import io.ktor.serialization.kotlinx.json.json import no.nav.helsearbeidsgiver.utils.json.jsonConfig +import io.ktor.client.network.sockets.SocketTimeoutException +import io.ktor.client.network.sockets.ConnectTimeoutException +import io.ktor.client.plugins.HttpRequestTimeoutException internal fun createHttpClient(): HttpClient = HttpClient(Apache5) { configure() } @@ -22,6 +25,9 @@ internal fun HttpClientConfig<*>.configure() { maxRetries = 3 retryOnServerErrors(maxRetries) retryOnExceptionIf { _, cause -> + cause is SocketTimeoutException || + cause is ConnectTimeoutException || + cause is HttpRequestTimeoutException || cause is java.net.SocketTimeoutException } exponentialDelay()