Compare commits

...

3 commits

Author SHA1 Message Date
microwin7
7950eea975
Updating .gitattributes to common standards (#648) 2023-06-30 20:23:23 +07:00
microwin7
04dd7d655c
[ANY] Case ignoring for commands in ServerWrapper (#657) 2023-06-30 20:22:22 +07:00
Gravita
bd83e8a4c5 [FEATURE] Support hikariMaxLifetime 2023-06-30 20:21:20 +07:00
4 changed files with 76 additions and 19 deletions

86
.gitattributes vendored
View file

@ -1,26 +1,78 @@
* text eol=lf * text=auto eol=lf
*.bat text eol=crlf *.[cC][mM][dD] text eol=crlf
*.sh text eol=lf *.[bB][aA][tT] text eol=crlf
*.[pP][sS]1 text eol=crlf
*.[sS][hH] text eol=lf
*.patch text eol=lf *.patch text eol=lf
*.java text eol=lf
*.scala text eol=lf
*.groovy text eol=lf
*.gradle text eol=crlf
gradle.properties text eol=crlf
/gradle/wrapper/gradle-wrapper.properties text eol=crlf
*.cfg text eol=lf
*.png binary *.png binary
*.jar binary
*.war binary
*.lzma binary *.lzma binary
*.zip binary *.zip binary
*.gzip binary *.gzip binary
*.dll binary
*.so binary
*.exe binary *.exe binary
*.ico binary
*.eot binary
*.ttf binary
*.woff binary
*.woff2 binary
*.a binary
*.lib binary
*.icns binary
*.jpg binary
*.jpeg binary
*.gif binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.tar binary
*.tar.gz binary
*.7z binary
*.pyc binary
*.gpg binary
*.bin binary
*.gitattributes text eol=crlf *.gitattributes text
*.gitignore text eol=crlf .gitignore text
# Java sources
*.java text diff=java
*.kt text diff=kotlin
*.groovy text diff=java
*.scala text diff=java
*.gradle text diff=java
*.gradle.kts text diff=kotlin
# These files are text and should be normalized (Convert crlf => lf)
*.css text diff=css
*.scss text diff=css
*.sass text
*.df text
*.htm text diff=html
*.html text diff=html
*.js text
*.jsp text
*.jspf text
*.jspx text
*.properties text
*.tld text
*.tag text
*.tagx text
*.xml text
# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.dll binary
*.ear binary
*.jar binary
*.so binary
*.war binary
*.jks binary
mvnw text eol=lf
gradlew text eol=lf

View file

@ -33,6 +33,7 @@ public final class MySQLSourceConfig implements AutoCloseable, SQLSourceConfig {
private String password; private String password;
private String database; private String database;
private String timezone; private String timezone;
private long hikariMaxLifetime = 30*60*1000; // 30 minutes
private boolean useHikari; private boolean useHikari;
// Cache // Cache
@ -110,6 +111,7 @@ public synchronized Connection getConnection() throws SQLException {
hikariConfig.setConnectionTimeout(1000); hikariConfig.setConnectionTimeout(1000);
hikariConfig.setAutoCommit(true); hikariConfig.setAutoCommit(true);
hikariConfig.setLeakDetectionThreshold(2000); hikariConfig.setLeakDetectionThreshold(2000);
hikariConfig.setMaxLifetime(hikariMaxLifetime);
// Set HikariCP pool // Set HikariCP pool
// Replace source with hds // Replace source with hds
source = new HikariDataSource(hikariConfig); source = new HikariDataSource(hikariConfig);

View file

@ -27,6 +27,8 @@ public final class PostgreSQLSourceConfig implements AutoCloseable, SQLSourceCon
private String password; private String password;
private String database; private String database;
private long hikariMaxLifetime = 30*60*1000; // 30 minutes
// Cache // Cache
private transient DataSource source; private transient DataSource source;
private transient boolean hikari; private transient boolean hikari;
@ -66,6 +68,7 @@ public synchronized Connection getConnection() throws SQLException {
hikariSource.setMinimumIdle(0); hikariSource.setMinimumIdle(0);
hikariSource.setMaximumPoolSize(MAX_POOL_SIZE); hikariSource.setMaximumPoolSize(MAX_POOL_SIZE);
hikariSource.setIdleTimeout(TIMEOUT * 1000L); hikariSource.setIdleTimeout(TIMEOUT * 1000L);
hikariSource.setMaxLifetime(hikariMaxLifetime);
// Replace source with hds // Replace source with hds
source = hikariSource; source = hikariSource;

View file

@ -98,14 +98,14 @@ public void run(String... args) throws Throwable {
GetAvailabilityAuthRequest.registerProviders(); GetAvailabilityAuthRequest.registerProviders();
OptionalAction.registerProviders(); OptionalAction.registerProviders();
OptionalTrigger.registerProviders(); OptionalTrigger.registerProviders();
if (args.length > 0 && args[0].equals("setup") && !disableSetup) { if (args.length > 0 && args[0].equalsIgnoreCase("setup") && !disableSetup) {
LogHelper.debug("Read ServerWrapperConfig.json"); LogHelper.debug("Read ServerWrapperConfig.json");
loadConfig(); loadConfig();
ServerWrapperSetup setup = new ServerWrapperSetup(); ServerWrapperSetup setup = new ServerWrapperSetup();
setup.run(); setup.run();
System.exit(0); System.exit(0);
} }
if (args.length > 1 && args[0].equals("installAuthlib") && !disableSetup) { if (args.length > 1 && args[0].equalsIgnoreCase("installAuthlib") && !disableSetup) {
LogHelper.debug("Read ServerWrapperConfig.json"); LogHelper.debug("Read ServerWrapperConfig.json");
loadConfig(); loadConfig();
InstallAuthlib command = new InstallAuthlib(); InstallAuthlib command = new InstallAuthlib();