1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-29 13:38:43 +00:00

hotfix for installing of HttpTimeout inside of client only in case when it was not installed previously

This commit is contained in:
InsanusMokrassar 2020-03-19 11:10:18 +06:00
parent badb138bc1
commit c9de4bc79e

View File

@ -12,8 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.RetryAfterError
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import io.ktor.client.HttpClient
import io.ktor.client.call.receive
import io.ktor.client.features.ClientRequestException
import io.ktor.client.features.HttpTimeout
import io.ktor.client.features.*
import io.ktor.client.statement.HttpStatement
import io.ktor.client.statement.readText
import kotlinx.coroutines.delay
@ -37,7 +36,9 @@ class KtorRequestsExecutor(
}
private val client = client.config {
install(HttpTimeout)
if (client.feature(HttpTimeout) == null) {
install(HttpTimeout)
}
}
override suspend fun <T : Any> execute(request: Request<T>): T {