mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 09:52:16 -05:00
Don't write the new push state to the database for every message
This commit is contained in:
parent
b660d45b6c
commit
1cd7df1369
@ -1296,14 +1296,15 @@ public class MessagingController implements Runnable {
|
|||||||
|
|
||||||
fetchUnsyncedMessages(account, remoteFolder, localFolder, unsyncedMessages, smallMessages, largeMessages, progress, todo, fp);
|
fetchUnsyncedMessages(account, remoteFolder, localFolder, unsyncedMessages, smallMessages, largeMessages, progress, todo, fp);
|
||||||
|
|
||||||
// If a message didn't exist, messageFinished won't be called, but we shouldn't try again
|
String updatedPushState = localFolder.getPushState();
|
||||||
// If we got here, nothing failed
|
|
||||||
for (Message message : unsyncedMessages) {
|
for (Message message : unsyncedMessages) {
|
||||||
String newPushState = remoteFolder.getNewPushState(localFolder.getPushState(), message);
|
String newPushState = remoteFolder.getNewPushState(updatedPushState, message);
|
||||||
if (newPushState != null) {
|
if (newPushState != null) {
|
||||||
localFolder.setPushState(newPushState);
|
updatedPushState = newPushState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
localFolder.setPushState(updatedPushState);
|
||||||
|
|
||||||
if (K9.DEBUG) {
|
if (K9.DEBUG) {
|
||||||
Log.d(K9.LOG_TAG, "SYNC: Synced unsynced messages for folder " + folder);
|
Log.d(K9.LOG_TAG, "SYNC: Synced unsynced messages for folder " + folder);
|
||||||
}
|
}
|
||||||
@ -1462,10 +1463,6 @@ public class MessagingController implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void messageFinished(T message, int number, int ofTotal) {
|
public void messageFinished(T message, int number, int ofTotal) {
|
||||||
try {
|
try {
|
||||||
String newPushState = remoteFolder.getNewPushState(localFolder.getPushState(), message);
|
|
||||||
if (newPushState != null) {
|
|
||||||
localFolder.setPushState(newPushState);
|
|
||||||
}
|
|
||||||
if (message.isSet(Flag.DELETED) || message.olderThan(earliestDate)) {
|
if (message.isSet(Flag.DELETED) || message.olderThan(earliestDate)) {
|
||||||
|
|
||||||
if (K9.DEBUG) {
|
if (K9.DEBUG) {
|
||||||
|
Loading…
Reference in New Issue
Block a user