mirror of https://github.com/M66B/FairEmail.git
Queue fetch for message added/remove in transaction
This commit is contained in:
parent
e5e17a7e9d
commit
c6d38bf032
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue