From dd895157c60432bd57816755710d5eb621d7d36e Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 9 Nov 2025 01:38:16 +0100 Subject: [PATCH] Throttle WebInterfaceManager requests retries (#1772) --- .../suwayomi/tachidesk/server/util/WebInterfaceManager.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt index cf365a87..57cf4296 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt @@ -22,6 +22,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.combine @@ -62,6 +63,7 @@ import java.net.URI import java.nio.charset.StandardCharsets import java.security.MessageDigest import java.util.Date +import kotlin.time.Duration import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.seconds @@ -545,6 +547,7 @@ object WebInterfaceManager { execute: suspend () -> T, maxRetries: Int = 3, retryCount: Int = 0, + timeout: Duration = 2.seconds, ): T { try { return execute() @@ -552,6 +555,7 @@ object WebInterfaceManager { log.warn(e) { "(retry $retryCount/$maxRetries) failed due to" } if (retryCount < maxRetries) { + delay(timeout.times(retryCount + 1)) return executeWithRetry(log, execute, maxRetries, retryCount + 1) }