Skip to content

Commit

Permalink
detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
Augusto César Dias committed Mar 19, 2024
1 parent 893218c commit 61121aa
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ import kotlinx.coroutines.flow.retry

private const val RETRY_COUNT = 3L

private fun String.parseIgnoreError(default: Long? = null): Long? = try {
this.toLong()
private fun String?.parseIgnoreError(default: Long? = null): Long? = try {
this?.toLong() ?: default
} catch (_: NumberFormatException) {
default
}
Expand All @@ -101,9 +101,9 @@ class RemoteMonkey(monkeyConfig: MonkeyConfig.Remote, monkeyType: MonkeyType, in

HttpClient(OkHttp.create()) {
install(HttpTimeout) {
socketTimeoutMillis = System.getenv("MONKEYS_SOCKET_TIMEOUT")?.parseIgnoreError(INFINITE_TIMEOUT_MS)
requestTimeoutMillis = System.getenv("MONKEYS_REQUEST_TIMEOUT")?.parseIgnoreError(INFINITE_TIMEOUT_MS)
connectTimeoutMillis = System.getenv("MONKEYS_CONNECT_TIMEOUT")?.parseIgnoreError(INFINITE_TIMEOUT_MS)
socketTimeoutMillis = System.getenv("MONKEYS_SOCKET_TIMEOUT").parseIgnoreError(INFINITE_TIMEOUT_MS)
requestTimeoutMillis = System.getenv("MONKEYS_REQUEST_TIMEOUT").parseIgnoreError(INFINITE_TIMEOUT_MS)
connectTimeoutMillis = System.getenv("MONKEYS_CONNECT_TIMEOUT").parseIgnoreError(INFINITE_TIMEOUT_MS)
}
install(HttpRequestRetry)
expectSuccess = true
Expand Down Expand Up @@ -249,7 +249,10 @@ class RemoteMonkey(monkeyConfig: MonkeyConfig.Remote, monkeyType: MonkeyType, in
}

override suspend fun createConversation(
name: String, monkeyList: List<Monkey>, protocol: ConversationOptions.Protocol, isDestroyable: Boolean
name: String,
monkeyList: List<Monkey>,
protocol: ConversationOptions.Protocol,
isDestroyable: Boolean
): MonkeyConversation {
val result: ConversationId = post(
CREATE_CONVERSATION, CreateConversationRequest(name, monkeyList.map { it.monkeyType.userId() }, protocol, isDestroyable)
Expand Down

0 comments on commit 61121aa

Please sign in to comment.