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:
parent
ecf07433df
commit
389424fbb8
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user