Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Sep 11, 2023
1 parent a1e3f2c commit 380529f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/kotlin/tech/relaycorp/poweb/PoWebClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ public class PoWebClient internal constructor(
headers?.forEach { header(it.first, it.second) }
}
repeat(Int.MAX_VALUE) {
logger.info { "Starting WebSocket connection attempt #$it" }
try {
return ktorClient.webSocket(url, request, block)
} catch (exc: EOFException) {
Expand All @@ -322,7 +323,10 @@ public class PoWebClient internal constructor(
logger.info { "WebSocket connection ended abruptly (${exc.message}). Will retry." }
delay(ABRUPT_DISCONNECT_RETRY_DELAY)
} catch (exc: IOException) {
logger.info { "Server is unreachable (${exc.message})" }
throw ServerConnectionException("Server is unreachable", exc)
} finally {
logger.info { "WebSocket connection attempt #$it ended" }
}
}
}
Expand Down

0 comments on commit 380529f

Please sign in to comment.