From 801bcbffbcb7e9f681fd2a09990783fdd322ad3c Mon Sep 17 00:00:00 2001 From: EmmaKnijn <64010592+EmmaKnijn@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:14:28 +0200 Subject: [PATCH] only send tps that is under 20 --- src/main/java/ct/server/Ctserver.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/ct/server/Ctserver.java b/src/main/java/ct/server/Ctserver.java index 4433f4f..f7bc5f6 100644 --- a/src/main/java/ct/server/Ctserver.java +++ b/src/main/java/ct/server/Ctserver.java @@ -69,13 +69,15 @@ public class Ctserver implements ModInitializer { //LOGGER.info(String.valueOf(timeBetween)); //LOGGER.info(String.valueOf(mspt)); //LOGGER.info(String.valueOf(tps)); - CompletableFuture.runAsync(() -> { - try { - sendPostRequest("http://us-ky-medium-0004.knijn.one:58926/tps", String.valueOf(tps)); - } catch (Exception e) { - LOGGER.error("Failed to send POST request", e); - } - }); + if (tps < 20) { + CompletableFuture.runAsync(() -> { + try { + sendPostRequest("http://us-ky-medium-0004.knijn.one:58926/tps", String.valueOf(tps)); + } catch (Exception e) { + LOGGER.error("Failed to send POST request", e); + } + }); + } //LOGGER.info("Sent HTTP request"); tickCounter = 0; zeroTicks = Instant.now().toEpochMilli();