1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-20 07:01:22 +01:00

Vacuum is our friend

This commit is contained in:
Zrips 2019-11-06 11:04:27 +02:00
parent ecf07433df
commit 389424fbb8

View File

@ -477,6 +477,7 @@ public abstract class JobsDAO {
if (getConnection() == null)
return;
vacuum();
setupConfig();
try {
@ -2646,6 +2647,24 @@ public abstract class JobsDAO {
}
}
public synchronized void vacuum() {
if (dbType != DataBaseType.SqLite)
return;
JobsConnection conn = getConnection();
if (conn == null)
return;
PreparedStatement prest = null;
try {
prest = conn.prepareStatement("VACUUM;");
prest.execute();
} catch (Exception | Error e) {
} finally {
close(prest);
}
return;
}
/**
* Close all active database handles
*/