mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
several improvements in requests limiters
This commit is contained in:
parent
5434df1f02
commit
8e64205f53
@ -1,5 +1,7 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 4.2.3
|
||||||
|
|
||||||
## 4.2.2
|
## 4.2.2
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=4.2.2
|
library_version=4.2.3
|
||||||
|
@ -36,7 +36,9 @@ class ExceptionsOnlyLimiter(
|
|||||||
|
|
||||||
override suspend fun <T> limit(block: suspend () -> T): T {
|
override suspend fun <T> limit(block: suspend () -> T): T {
|
||||||
while (true) {
|
while (true) {
|
||||||
lockState.first { !it }
|
if (lockState.value) {
|
||||||
|
lockState.first { it == false }
|
||||||
|
}
|
||||||
var throwable: Throwable? = null
|
var throwable: Throwable? = null
|
||||||
val result = safely({
|
val result = safely({
|
||||||
throwable = when (it) {
|
throwable = when (it) {
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.bot.settings.limiters
|
||||||
|
|
||||||
|
object NoLimitsLimiter : RequestLimiter {
|
||||||
|
override suspend fun <T> limit(block: suspend () -> T): T = block()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user