Rework the "update with..." methods to avoid re-saving deleted models.

pull/1/head
Matthew Chen 8 years ago
parent c6160a5a1e
commit 94b59c326e

@ -718,12 +718,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
success:^{ success:^{
DDLogInfo(@"%@ Marking group message as sent to recipient: %@", self.logTag, recipient.uniqueId); DDLogInfo(@"%@ Marking group message as sent to recipient: %@", self.logTag, recipient.uniqueId);
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
// Update the message unless it has been deleted.
if ([TSOutgoingMessage fetchObjectWithUniqueID:message.uniqueId]) {
[message updateWithSentRecipient:recipient.uniqueId transaction:transaction]; [message updateWithSentRecipient:recipient.uniqueId transaction:transaction];
} else {
DDLogInfo(@"%@ not marking message as sent to recipient; message deleted.", self.logTag);
}
}]; }];
[futureSource trySetResult:@1]; [futureSource trySetResult:@1];
} }

Loading…
Cancel
Save