mirror of https://github.com/M66B/FairEmail.git
Moved vacuum to cleanup
This commit is contained in:
parent
0b7e5a8e21
commit
d91a30293a
|
@ -130,18 +130,6 @@ public abstract class DB extends RoomDatabase {
|
|||
|
||||
sInstance = migrate(acontext, getBuilder(acontext));
|
||||
|
||||
// https://www.sqlite.org/lang_vacuum.html
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean vacuum = prefs.getBoolean("vacuum", false);
|
||||
if (vacuum)
|
||||
try {
|
||||
Log.i("Running VACUUM");
|
||||
sInstance.getOpenHelper().getWritableDatabase().execSQL("VACUUM;");
|
||||
prefs.edit().remove("vacuum").apply();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
sInstance.getInvalidationTracker().addObserver(new InvalidationTracker.Observer(
|
||||
EntityAccount.TABLE_NAME,
|
||||
EntityIdentity.TABLE_NAME,
|
||||
|
|
|
@ -339,9 +339,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putBoolean("vacuum", true).apply();
|
||||
|
||||
WorkerCleanup.cleanup(context, true);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -221,6 +221,13 @@ public class WorkerCleanup extends Worker {
|
|||
Log.i("Cleanup log");
|
||||
int logs = db.log().deleteLogs(now - KEEP_LOG_DURATION);
|
||||
Log.i("Deleted logs=" + logs);
|
||||
|
||||
if (manual) {
|
||||
// https://www.sqlite.org/lang_vacuum.html
|
||||
Log.i("Running VACUUM");
|
||||
db.getOpenHelper().getWritableDatabase().execSQL("VACUUM;");
|
||||
}
|
||||
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue