forked from TuxCoding/FastLogin
Compare commits
5 Commits
add-postgr
...
database-l
Author | SHA1 | Date | |
---|---|---|---|
4abd6b9134 | |||
4717bf82f7 | |||
0214827266 | |||
55adbaa58b | |||
7603da0b6b |
@ -165,7 +165,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.papermc.paper</groupId>
|
<groupId>io.papermc.paper</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<!-- Use our own newer api version -->
|
<!-- Use our own newer api version -->
|
||||||
<exclusions>
|
<exclusions>
|
||||||
|
@ -250,7 +250,6 @@ public class ProtocolLibListener extends PacketAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
plugin.getLog().trace("GameProfile {} with {} connecting", sessionKey, username);
|
plugin.getLog().trace("GameProfile {} with {} connecting", sessionKey, username);
|
||||||
|
|
||||||
packetEvent.getAsyncMarker().incrementProcessingDelay();
|
packetEvent.getAsyncMarker().incrementProcessingDelay();
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
<artifactId>HikariCP</artifactId>
|
<artifactId>HikariCP</artifactId>
|
||||||
<version>4.0.3</version>
|
<version>5.0.2-SNAPSHOT</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<!-- HikariCP uses an old version of this API that has a typo in the service interface -->
|
<!-- HikariCP uses an old version of this API that has a typo in the service interface -->
|
||||||
<!-- We will use the api provided by the jdk14 dependency -->
|
<!-- We will use the api provided by the jdk14 dependency -->
|
||||||
|
@ -55,6 +55,9 @@ public class MySQLStorage extends SQLStorage {
|
|||||||
config.addDataSourceProperty("useSSL", useSSL);
|
config.addDataSourceProperty("useSSL", useSSL);
|
||||||
config.addDataSourceProperty("requireSSL", useSSL);
|
config.addDataSourceProperty("requireSSL", useSSL);
|
||||||
|
|
||||||
|
//enable leak detection of holding connections
|
||||||
|
config.setLeakDetectionThreshold(10_000);
|
||||||
|
|
||||||
// adding paranoid, hides hostname, username, version and so
|
// adding paranoid, hides hostname, username, version and so
|
||||||
// could be useful for hiding server details
|
// could be useful for hiding server details
|
||||||
config.addDataSourceProperty("paranoid", true);
|
config.addDataSourceProperty("paranoid", true);
|
||||||
@ -62,7 +65,7 @@ public class MySQLStorage extends SQLStorage {
|
|||||||
config.setJdbcUrl(JDBC_PROTOCOL + buildJDBCUrl(driver, host, port, database));
|
config.setJdbcUrl(JDBC_PROTOCOL + buildJDBCUrl(driver, host, port, database));
|
||||||
|
|
||||||
// enable MySQL specific optimizations
|
// enable MySQL specific optimizations
|
||||||
addPerformanceProperties(config);
|
// addPerformanceProperties(config);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,11 +143,12 @@ public abstract class SQLStorage implements AuthStorage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(StoredProfile playerProfile) {
|
public void save(StoredProfile playerProfile) {
|
||||||
try (Connection con = dataSource.getConnection()) {
|
|
||||||
String uuid = playerProfile.getOptId().map(UUIDAdapter::toMojangId).orElse(null);
|
String uuid = playerProfile.getOptId().map(UUIDAdapter::toMojangId).orElse(null);
|
||||||
|
core.getPlugin().getLog().info("Before Lock");
|
||||||
playerProfile.getSaveLock().lock();
|
synchronized (playerProfile) {
|
||||||
try {
|
core.getPlugin().getLog().info("Inside Lock - Before acquiring connection");
|
||||||
|
try (Connection con = dataSource.getConnection()) {
|
||||||
|
core.getPlugin().getLog().info("Acquired connection");
|
||||||
if (playerProfile.isSaved()) {
|
if (playerProfile.isSaved()) {
|
||||||
try (PreparedStatement saveStmt = con.prepareStatement(UPDATE_PROFILE)) {
|
try (PreparedStatement saveStmt = con.prepareStatement(UPDATE_PROFILE)) {
|
||||||
saveStmt.setString(1, uuid);
|
saveStmt.setString(1, uuid);
|
||||||
@ -174,12 +175,14 @@ public abstract class SQLStorage implements AuthStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
playerProfile.getSaveLock().unlock();
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
core.getPlugin().getLog().error("Failed to save playerProfile {}", playerProfile, ex);
|
core.getPlugin().getLog().error("Failed to save playerProfile {}", playerProfile, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.getPlugin().getLog().info("Released connection");
|
||||||
|
}
|
||||||
|
|
||||||
|
core.getPlugin().getLog().info("Released lock");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user