several improvements in requests limiters

This commit is contained in:
InsanusMokrassar committed 2022-12-26 20:49:29 +06:00
1 parent 5434df1f02
commit 8e64205f53
4 files changed
+11 -2

No files matched your search

@@ -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()
}