From 37437fe369180960d8929ead37a5b616090c3919 Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Fri, 25 Oct 2024 02:25:18 +0200 Subject: [PATCH] Fix ratelimit exception --- .../mikbot/core/health/ratelimit/DistributedRateLimiter.kt | 2 +- gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/ratelimit/DistributedRateLimiter.kt b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/ratelimit/DistributedRateLimiter.kt index 97a60c1d..64710200 100644 --- a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/ratelimit/DistributedRateLimiter.kt +++ b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/ratelimit/DistributedRateLimiter.kt @@ -85,7 +85,7 @@ class DistributedRateLimiter(proxyManager: ProxyManager) : RequestRateLi .capacity(limit.remaining.value) .refillIntervallyAligned( limit.total.value, - (Clock.System.now() - reset.value).toJavaDuration(), + (reset.value - Clock.System.now()).coerceAtMost(Duration.ZERO).toJavaDuration(), start.toJavaInstant() ) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 569688da..f4f2eb79 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ coroutines = "1.9.0" serialization = "1.7.3" ktor = "3.0.0" kord = "feature-user-apps-20241022.210712-8" -api = "3.37.12" +api = "3.37.13" ksp = "2.0.21-1.0.25" lavakord = "7.1.0"