Skip to content

Commit

Permalink
Fixed SQLite purges not successfully completing on some systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelli committed Jan 5, 2022
1 parent 947c598 commit 03bd194
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/net/coreprotect/command/PurgeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ class BasicThread implements Runnable {

@Override
public void run() {
try (Connection connection = Database.getConnection(false, 500)) {
try {
long timestamp = (System.currentTimeMillis() / 1000L);
long ptime = timestamp - seconds;
long removed = 0;

Connection connection = null;
for (int i = 0; i <= 5; i++) {
connection = Database.getConnection(false, 500);
if (connection != null) {
break;
}
Expand Down Expand Up @@ -342,6 +344,8 @@ else if (argWid > 0) {
}
}

connection.close();

if (abort) {
if (!Config.getGlobal().MYSQL) {
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).delete();
Expand Down

0 comments on commit 03bd194

Please sign in to comment.