Skip to content

Commit

Permalink
fix: allow Agones game counters to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakShearman committed Oct 11, 2024
1 parent 3911aaf commit 56b3324
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

public final class AgonesGameStatusListener implements GameStatusListener {
private static final Logger LOGGER = LoggerFactory.getLogger(AgonesGameStatusListener.class);
private static final boolean DISABLE_AGONES_GAME_COUNTER = Boolean.parseBoolean(System.getenv("DISABLE_AGONES_GAME_COUNTER"));

private final @NotNull GameProvider gameProvider;
private final @NotNull KubernetesModule kubeModule;
Expand All @@ -32,6 +33,8 @@ public AgonesGameStatusListener(@NotNull GameProvider gameProvider, @NotNull Kub

@Override
public void onGameRemoved(@NotNull Game game) {
if (DISABLE_AGONES_GAME_COUNTER) return;

Thread.startVirtualThread(() -> {
this.kubeModule.updateAgonesCounter("games", -1);
this.kubeModule.removeFromAgonesList("games", game.getCreationInfo().id());
Expand Down

0 comments on commit 56b3324

Please sign in to comment.