mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-11-07 12:23:14 +00:00
several improvements in requests limiters
This commit is contained in:
1 parent
5434df1f02
commit
8e64205f53
4 files changed
+11
-2
No files matched your search
+3
-1
@@ -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) {
|
||||
|
||||
+5
@@ -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