From 0d89840179c363464029c66a3dcb7bf702f51c14 Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 3 Mar 2018 20:41:46 +0000 Subject: [PATCH] Reduce the number of entries sent to the verbose viewer, cleanup old hikari try..catches --- .../connection/hikari/HikariConnectionFactory.java | 14 +++----------- .../lucko/luckperms/common/verbose/CheckData.java | 7 ++++++- .../luckperms/common/verbose/VerboseListener.java | 4 ++-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/hikari/HikariConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/hikari/HikariConnectionFactory.java index 6e301bb3..480b3b94 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/hikari/HikariConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/hikari/HikariConnectionFactory.java @@ -88,17 +88,9 @@ public abstract class HikariConnectionFactory extends AbstractConnectionFactory // If a connection is not returned within 10 seconds, it's probably safe to assume it's been leaked. config.setLeakDetectionThreshold(TimeUnit.SECONDS.toMillis(10)); // 10000 - // The drivers are really old in some of the older Spigot binaries, so Connection#isValid doesn't work. - config.setConnectionTestQuery("/* LuckPerms ping */ SELECT 1"); - - try { - // don't perform any initial connection validation - we subsequently call #getConnection - // to setup the schema anyways - config.setInitializationFailTimeout(-1); - } catch (NoSuchMethodError e) { - //noinspection deprecation - config.setInitializationFailFast(false); - } + // don't perform any initial connection validation - we subsequently call #getConnection + // to setup the schema anyways + config.setInitializationFailTimeout(-1); this.hikari = new HikariDataSource(config); } diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/CheckData.java b/common/src/main/java/me/lucko/luckperms/common/verbose/CheckData.java index dec98c7b..8c0a6619 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/CheckData.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/CheckData.java @@ -127,7 +127,12 @@ public class CheckData { public JsonObject toJson(StackTracePrinter tracePrinter) { return formBaseJson() .add("trace", new JArray() - .consume(arr -> tracePrinter.process(this.checkTrace, StackTracePrinter.elementToString(arr::add))) + .consume(arr -> { + int overflow = tracePrinter.process(this.checkTrace, StackTracePrinter.elementToString(arr::add)); + if (overflow != 0) { + arr.add("... and " + overflow + " more"); + } + }) ) .toJson(); } diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseListener.java b/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseListener.java index 75146fa8..dff6cc99 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseListener.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseListener.java @@ -56,11 +56,11 @@ public class VerboseListener { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); // how much data should we store before stopping. - private static final int DATA_TRUNCATION = 10000; + private static final int DATA_TRUNCATION = 3000; // how many lines should we include in each stack trace send as a chat message private static final int STACK_TRUNCATION_CHAT = 15; // how many lines should we include in each stack trace in the web output - private static final int STACK_TRUNCATION_WEB = 30; + private static final int STACK_TRUNCATION_WEB = 20; private static final StackTracePrinter FILTERING_PRINTER = StackTracePrinter.builder() .ignoreClassStartingWith("me.lucko.luckperms.")