mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Optimize database manager task performance.
Former-commit-id: 5cfb93168de53ff0b3c56afbe1a121f0b6171680
This commit is contained in:
1 parent
b7de8a2b9b
commit
2a7bff869a
1 file changed
+12
-12
@@ -85,20 +85,20 @@ public class DatabaseManager {
|
||||
* Internal method, runTasks in queue.
|
||||
*/
|
||||
private void runTask() {
|
||||
try {
|
||||
if (!this.database.getConnection().isValid(3000)) {
|
||||
this.plugin
|
||||
.getLogger()
|
||||
.warning(
|
||||
"Database connection may lost, we are trying reconnecting, if this message appear too many times, you should check your database file(sqlite) and internet connection(mysql).");
|
||||
return; // Waiting next crycle and hope it success reconnected.
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
plugin.getSentryErrorReporter().ignoreThrow();
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
while (true) {
|
||||
Timer timer = new Timer(true);
|
||||
try {
|
||||
if (!this.database.getConnection().isValid(3000)) {
|
||||
this.plugin
|
||||
.getLogger()
|
||||
.warning(
|
||||
"Database connection may lost, we are trying reconnecting, if this message appear too many times, you should check your database file(sqlite) and internet connection(mysql).");
|
||||
break; // Waiting next crycle and hope it success reconnected.
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
plugin.getSentryErrorReporter().ignoreThrow();
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
DatabaseTask task = sqlQueue.poll();
|
||||
if (task == null) {
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user