From 553def4a3eef7b7972a34b6fc50f6d1e8df80562 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 16 Mar 2025 07:40:00 +0700 Subject: [PATCH] fix: interval in QueryPlugin being too short causing output leaks --- .../java/me/chayapak1/chomens_bot/plugins/QueryPlugin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/plugins/QueryPlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/QueryPlugin.java index 772b2519..399215ba 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/QueryPlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/QueryPlugin.java @@ -86,11 +86,14 @@ public class QueryPlugin extends Bot.Listener { final UUID id = UUID.randomUUID(); ids.add(id); - // prevent memory leak in case the command returns no output + // this probably doesn't do much, since even if the command returns + // no output, the tracker will still tellraw to the bot that this command has + // completed no matter what, but just in case, we'll remove the + // transactions and the ids here after 30 seconds bot.executor.schedule(() -> { transactions.remove(transactionId); ids.remove(id); - }, 5, TimeUnit.SECONDS); + }, 30, TimeUnit.SECONDS); return Triple.of(future, transactionId, id); }