Skip to content

Commit a912bbe

Browse files
committed
feat: property (scale-ignore-players) to decide if the player count should be checked before a server scales down
1 parent 8d7e4ec commit a912bbe

File tree

1 file changed

+9
-1
lines changed
  • controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/reconciler

1 file changed

+9
-1
lines changed

controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/reconciler/GroupReconciler.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ class GroupReconciler(
5858
return
5959

6060
val serverCountToStop = fullyStartedServers.size - this.group.minOnlineCount
61-
fullyStartedServers
61+
val serversToConsider = if (this.group.properties["scale-ignore-players"]?.toBoolean() == true) {
62+
// If scale-ignore-players is true, consider all fully started servers
63+
fullyStartedServers
64+
} else {
65+
// If scale-ignore-players is false, only consider servers without players
66+
fullyStartedServers.filter { it.playerCount == 0L }
67+
}
68+
69+
serversToConsider
6270
.filter { !wasUpdatedRecently(it) }
6371
.shuffled()
6472
.take(serverCountToStop.toInt())

0 commit comments

Comments
 (0)