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 @Override
public void run() { public void run() {
try (Connection connection = Database.getConnection(false, 500)) { try {
long timestamp = (System.currentTimeMillis() / 1000L); long timestamp = (System.currentTimeMillis() / 1000L);
long ptime = timestamp - seconds; long ptime = timestamp - seconds;
long removed = 0; long removed = 0;
Connection connection = null;
for (int i = 0; i <= 5; i++) { for (int i = 0; i <= 5; i++) {
connection = Database.getConnection(false, 500);
if (connection != null) { if (connection != null) {
break; break;
} }
@ -342,6 +344,8 @@ public class PurgeCommand extends Consumer {
} }
} }
connection.close();
if (abort) { if (abort) {
if (!Config.getGlobal().MYSQL) { if (!Config.getGlobal().MYSQL) {
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).delete(); (new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).delete();