mirror of https://github.com/M66B/FairEmail.git
Run daily job in transaction
This commit is contained in:
parent
688a661c5d
commit
88c034b610
|
@ -61,6 +61,9 @@ public class JobDaily extends JobService {
|
|||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
Log.i(Helper.TAG, "Start daily job");
|
||||
|
||||
// Cleanup message files
|
||||
|
@ -96,8 +99,14 @@ public class JobDaily extends JobService {
|
|||
int logs = db.log().deleteLogs(before);
|
||||
Log.i(Helper.TAG, "Deleted logs=" + logs);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
Log.i(Helper.TAG, "End daily job");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue