mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
hotfix for installing of HttpTimeout inside of client only in case when it was not installed previously
This commit is contained in:
parent
badb138bc1
commit
c9de4bc79e
@ -12,8 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.RetryAfterError
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.call.receive
|
import io.ktor.client.call.receive
|
||||||
import io.ktor.client.features.ClientRequestException
|
import io.ktor.client.features.*
|
||||||
import io.ktor.client.features.HttpTimeout
|
|
||||||
import io.ktor.client.statement.HttpStatement
|
import io.ktor.client.statement.HttpStatement
|
||||||
import io.ktor.client.statement.readText
|
import io.ktor.client.statement.readText
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
@ -37,8 +36,10 @@ class KtorRequestsExecutor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val client = client.config {
|
private val client = client.config {
|
||||||
|
if (client.feature(HttpTimeout) == null) {
|
||||||
install(HttpTimeout)
|
install(HttpTimeout)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun <T : Any> execute(request: Request<T>): T {
|
override suspend fun <T : Any> execute(request: Request<T>): T {
|
||||||
return try {
|
return try {
|
||||||
|
Loading…
Reference in New Issue
Block a user