1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 16:47:13 +00:00

update miroutils and fill changelog

This commit is contained in:
InsanusMokrassar 2022-12-28 09:05:32 +06:00
parent 0fff553ce1
commit 2a32654d57
3 changed files with 7 additions and 12 deletions

View File

@ -2,6 +2,11 @@
## 4.2.3
* `Versions`:
* `MicroUtils`: `0.16.2` -> `0.16.4`
* `Core`:
* Simplify default `RequestsLimiter` (`ExceptionsOnlyLimiter`)
## 4.2.2
* `Versions`:

View File

@ -13,7 +13,7 @@ ktor = "2.2.1"
ksp = "1.7.22-1.0.8"
kotlin-poet = "1.12.0"
microutils = "0.16.2"
microutils = "0.16.4"
github-release-plugin = "2.4.1"
dokka = "1.7.20"

View File

@ -1,20 +1,10 @@
package dev.inmo.tgbotapi.bot.settings.limiters
import dev.inmo.micro_utils.coroutines.safely
import dev.inmo.tgbotapi.bot.exceptions.TooMuchRequestsException
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.MilliSeconds
import dev.inmo.tgbotapi.types.RetryAfterError
import io.ktor.client.plugins.ClientRequestException
import io.ktor.http.HttpStatusCode
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
/**
* Simple limiter which will lock any request when TooMuchRequestsExceptions is thrown and rerun request after lock time
* Simple limiter which will lock any request when [TooMuchRequestsExceptions] is thrown and rerun request after lock time
*/
object ExceptionsOnlyLimiter : RequestLimiter {
override suspend fun <T> limit(block: suspend () -> T): T {