Queue fetch for message added/remove in transaction

This commit is contained in:
M66B 2020-01-25 18:48:06 +01:00
parent e5e17a7e9d
commit c6d38bf032
1 changed files with 22 additions and 6 deletions

View File

@ -1004,10 +1004,18 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
wlMessage.acquire(); wlMessage.acquire();
Log.i(folder.name + " messages added"); Log.i(folder.name + " messages added");
try {
db.beginTransaction();
for (Message imessage : e.getMessages()) { for (Message imessage : e.getMessages()) {
long uid = ifolder.getUID(imessage); long uid = ifolder.getUID(imessage);
EntityOperation.queue(ServiceSynchronize.this, folder, EntityOperation.FETCH, uid); EntityOperation.queue(ServiceSynchronize.this, folder, EntityOperation.FETCH, uid);
} }
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(folder.name, ex); Log.e(folder.name, ex);
EntityLog.log( EntityLog.log(
@ -1025,10 +1033,18 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
wlMessage.acquire(); wlMessage.acquire();
Log.i(folder.name + " messages removed"); Log.i(folder.name + " messages removed");
try {
db.beginTransaction();
for (Message imessage : e.getMessages()) { for (Message imessage : e.getMessages()) {
long uid = ifolder.getUID(imessage); long uid = ifolder.getUID(imessage);
EntityOperation.queue(ServiceSynchronize.this, folder, EntityOperation.FETCH, uid); EntityOperation.queue(ServiceSynchronize.this, folder, EntityOperation.FETCH, uid);
} }
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(folder.name, ex); Log.e(folder.name, ex);
EntityLog.log( EntityLog.log(