File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/main/kotlin/dev/arbjerg/lavalink/internal/loadbalancing Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package dev.arbjerg.lavalink.internal.loadbalancing
3
3
import dev.arbjerg.lavalink.client.LavalinkNode
4
4
import dev.arbjerg.lavalink.client.loadbalancing.MAX_ERROR
5
5
import dev.arbjerg.lavalink.protocol.v4.Message
6
+ import kotlin.math.max
6
7
import kotlin.math.pow
7
8
8
9
// Clearing them on a timer sucks, here's some ideas from freya:
@@ -61,7 +62,8 @@ data class Penalties(val node: LavalinkNode) {
61
62
// The way we calculate penalties is heavily based on the original Lavalink client.
62
63
63
64
// This will serve as a rule of thumb. 1 playing player = 1 penalty point
64
- val playerPenalty = node.playerCache.count { it.value.track != null && ! it.value.paused }
65
+ val cachedPlayingPlayers = node.playerCache.count { it.value.track != null && ! it.value.paused }
66
+ val playerPenalty = max(cachedPlayingPlayers, stats.playingPlayers)
65
67
66
68
val cpuPenalty = (1.05 .pow(100 * stats.cpu.systemLoad) * 10 - 10 ).toInt()
67
69
You can’t perform that action at this time.
0 commit comments