Reduce the number of entries sent to the verbose viewer, cleanup old hikari try..catches

This commit is contained in:
Luck 2018-03-03 20:41:46 +00:00
parent f93e8fdccd
commit 0d89840179
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
3 changed files with 11 additions and 14 deletions

View File

@ -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. // 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 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. // don't perform any initial connection validation - we subsequently call #getConnection
config.setConnectionTestQuery("/* LuckPerms ping */ SELECT 1"); // to setup the schema anyways
config.setInitializationFailTimeout(-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);
}
this.hikari = new HikariDataSource(config); this.hikari = new HikariDataSource(config);
} }

View File

@ -127,7 +127,12 @@ public class CheckData {
public JsonObject toJson(StackTracePrinter tracePrinter) { public JsonObject toJson(StackTracePrinter tracePrinter) {
return formBaseJson() return formBaseJson()
.add("trace", new JArray() .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(); .toJson();
} }

View File

@ -56,11 +56,11 @@ public class VerboseListener {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
// how much data should we store before stopping. // 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 // how many lines should we include in each stack trace send as a chat message
private static final int STACK_TRUNCATION_CHAT = 15; private static final int STACK_TRUNCATION_CHAT = 15;
// how many lines should we include in each stack trace in the web output // 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() private static final StackTracePrinter FILTERING_PRINTER = StackTracePrinter.builder()
.ignoreClassStartingWith("me.lucko.luckperms.") .ignoreClassStartingWith("me.lucko.luckperms.")