diff --git a/src/main/kotlin/no/nav/syfo/elector/LeaderElector.kt b/src/main/kotlin/no/nav/syfo/elector/LeaderElector.kt index 53611db3..ab0c4b25 100644 --- a/src/main/kotlin/no/nav/syfo/elector/LeaderElector.kt +++ b/src/main/kotlin/no/nav/syfo/elector/LeaderElector.kt @@ -15,13 +15,13 @@ class LeaderElector( suspend fun isLeader(): Boolean { val hostname: String = withContext(Dispatchers.IO) { InetAddress.getLocalHost() }.hostName - try { + return try { val leader = httpClient.get(getHttpPath(electorPath)).body() - return leader.name == hostname + leader.name == hostname } catch (e: Exception) { val message = "Kall mot elector feiler" - log.error(message) - throw RuntimeException(message) + log.warn(message) + false } }