mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-16 13:49:26 +00:00
several improvements in requests limiters
This commit is contained in:
@@ -36,7 +36,9 @@ class ExceptionsOnlyLimiter(
|
||||
|
||||
override suspend fun <T> limit(block: suspend () -> T): T {
|
||||
while (true) {
|
||||
lockState.first { !it }
|
||||
if (lockState.value) {
|
||||
lockState.first { it == false }
|
||||
}
|
||||
var throwable: Throwable? = null
|
||||
val result = safely({
|
||||
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()
|
||||
}
|
Reference in New Issue
Block a user