Fixed SQLite purges not successfully completing on some systems

This commit is contained in:
Intelli 2022-01-04 17:55:52 -07:00
parent 947c59882e
commit 03bd19480e

View File

@ -94,12 +94,14 @@ public class PurgeCommand extends Consumer {
@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;
}
@ -342,6 +344,8 @@ public class PurgeCommand extends Consumer {
}
}
connection.close();
if (abort) {
if (!Config.getGlobal().MYSQL) {
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).delete();