Fixed race condition when syncing huge amount of deleted messages using AS

This commit is contained in:
Ludovic Marcotte committed 2014-03-06 14:16:08 -05:00
1 parent 0cea36df2e
commit 31ace947cb
3 files changed
+62 -30

No files matched your search

+10 -4
View File
@@ -1940,8 +1940,11 @@ static NSString *defaultUserID = @"anyone";
uid = [theId intValue];
result = [[imap4 client] fetchModseqForUid: uid];
modseq = [[[[result objectForKey: @"RawResponse"] objectForKey: @"fetch"] objectForKey: @"modseq"] intValue];
tag = [NSString stringWithFormat: @"%d-%d", uid, modseq-1];
if (modseq < 1)
modseq = 1;
tag = [NSString stringWithFormat: @"%d-%d", uid, modseq];
}
return tag;
@@ -1999,7 +2002,7 @@ static NSString *defaultUserID = @"anyone";
// Check updated items
//
//
// . uid fetch 1:* (FLAGS) (changedsince 171)
// . uid fetch 1:* (UID) (changedsince 171)
//
// To get the modseq of a specific message:
//
@@ -2101,11 +2104,14 @@ static NSString *defaultUserID = @"anyone";
// We fetch deleted ones
if (highestmodseq > 0)
{
id uid;
uids = [self fetchUIDsOfVanishedItems: highestmodseq];
for (i = 0; i < [uids count]; i++)
{
d = [NSDictionary dictionaryWithObject: @"deleted" forKey: [uids objectAtIndex: i]];
uid = [uids objectAtIndex: i];
d = [NSDictionary dictionaryWithObject: @"deleted" forKey: uid];
[allTokens addObject: d];
}
}