diff --git a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Rebalancer.kt b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Rebalancer.kt index af3ef60a..84044184 100644 --- a/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Rebalancer.kt +++ b/core/kubernetes/src/main/kotlin/dev/schlaubi/mikbot/core/health/Rebalancer.kt @@ -31,6 +31,7 @@ import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.put import kotlinx.serialization.json.putJsonArray import kotlinx.serialization.json.putJsonObject +import kotlin.math.ceil import kotlin.time.Duration.Companion.minutes import kotlin.time.TimeSource import io.kubernetes.client.util.Config as KubeConfig @@ -110,7 +111,7 @@ class RebalancerExtension(context: PluginContext) : MikBotModule(context) { private suspend fun reBalance(newTotalShards: Int) { val json = - generateStatefulSetSpec(replicas = newTotalShards / Config.SHARDS_PER_POD, totalShards = newTotalShards) + generateStatefulSetSpec(replicas = ceil(newTotalShards.toDouble() / Config.SHARDS_PER_POD.toDouble()).toInt(), totalShards = newTotalShards) val jsonPatch = generateStatefulSetSpec().generatePatch(json) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 33d10897..8d36a2e0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ coroutines = "1.8.1" serialization = "1.7.1" ktor = "2.3.11" kord = "feature-user-apps-20240825.234248-3" -api = "3.36.0" +api = "3.36.1" ksp = "2.0.0-1.0.22" lavakord = "7.1.0"