diff options
author | Luck <git@lucko.me> | 2023-08-28 16:50:58 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2023-08-28 16:51:08 +0100 |
commit | b443924a665574f21e05e115eafea6171b046a02 (patch) | |
tree | 32d8fce240823db50d244e3735b6bff9bad333ff | |
parent | fac7ec97a848835dacc860a596269be12ae86956 (diff) | |
download | spark-b443924a665574f21e05e115eafea6171b046a02.tar.gz spark-b443924a665574f21e05e115eafea6171b046a02.tar.bz2 spark-b443924a665574f21e05e115eafea6171b046a02.zip |
Clarify command timeout warning msg
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java index fc41b6f..ec1ea9a 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java @@ -352,10 +352,12 @@ public class SparkPlatform { // schedule a task to detect timeouts this.plugin.executeAsync(() -> { timeoutThread.set(Thread.currentThread()); + int warningIntervalSeconds = 5; + try { for (int i = 1; i <= 3; i++) { try { - Thread.sleep(5000); + Thread.sleep(warningIntervalSeconds * 1000); } catch (InterruptedException e) { // ignore } @@ -367,7 +369,8 @@ public class SparkPlatform { Thread executor = executorThread.get(); if (executor == null) { getPlugin().log(Level.WARNING, "A command execution has not completed after " + - (i * 5) + " seconds but there is no executor present. Perhaps the executor shutdown?"); + (i * warningIntervalSeconds) + " seconds but there is no executor present. Perhaps the executor shutdown?"); + getPlugin().log(Level.WARNING, "If the command subsequently completes without any errors, this warning should be ignored. :)"); } else { String stackTrace = Arrays.stream(executor.getStackTrace()) @@ -375,7 +378,8 @@ public class SparkPlatform { .collect(Collectors.joining("\n")); getPlugin().log(Level.WARNING, "A command execution has not completed after " + - (i * 5) + " seconds, it might be stuck. Trace: \n" + stackTrace); + (i * warningIntervalSeconds) + " seconds, it *might* be stuck. Trace: \n" + stackTrace); + getPlugin().log(Level.WARNING, "If the command subsequently completes without any errors, this warning should be ignored. :)"); } } } finally { |