Skip to content

Commit

Permalink
Log warn instead of error in LeaderElector
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasDev committed Jul 19, 2023
1 parent f70c328 commit d2e52d1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/kotlin/no/nav/syfo/elector/LeaderElector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<Leader>()
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
}
}

Expand Down

0 comments on commit d2e52d1

Please sign in to comment.