Service boot transaction

This commit is contained in:
M66B 2020-01-24 08:52:04 +01:00
parent 5abca1603a
commit 54f1948886
1 changed files with 21 additions and 14 deletions

View File

@ -1566,6 +1566,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
public void run() {
try {
DB db = DB.getInstance(context);
try {
db.beginTransaction();
// Reset accounts
for (EntityAccount account : db.account().getAccounts())
@ -1584,6 +1586,11 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
for (EntityMessage message : db.message().getSnoozed())
EntityMessage.snooze(context, message.id, message.ui_snoozed);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
// Restore schedule
schedule(context);