Revert "Fix OWSOrphanDataCleaner crash"

This reverts commit 82d03aa9d5.
pull/230/head
nielsandriesse 5 years ago
parent c4aafa44a6
commit 09ea92c10d

@ -340,8 +340,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
*stop = YES; *stop = YES;
return; return;
} }
if (![interaction respondsToSelector:@selector(uniqueThreadId)] if (interaction.uniqueThreadId.length < 1
|| interaction.uniqueThreadId.length < 1
|| ![threadIds containsObject:interaction.uniqueThreadId]) { || ![threadIds containsObject:interaction.uniqueThreadId]) {
[orphanInteractionIds addObject:interaction.uniqueId]; [orphanInteractionIds addObject:interaction.uniqueId];
} }
@ -630,13 +629,10 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
continue; continue;
} }
// Don't delete interactions which were created in the last N minutes. // Don't delete interactions which were created in the last N minutes.
BOOL hasTimestamp = [interaction respondsToSelector:@selector(timestamp)]; NSDate *creationDate = [NSDate ows_dateWithMillisecondsSince1970:interaction.timestamp];
if (hasTimestamp) { if ([creationDate isAfterDate:thresholdDate]) {
NSDate *creationDate = [NSDate ows_dateWithMillisecondsSince1970:interaction.timestamp]; OWSLogInfo(@"Skipping orphan interaction due to age: %f", fabs(creationDate.timeIntervalSinceNow));
if ([creationDate isAfterDate:thresholdDate]) { continue;
OWSLogInfo(@"Skipping orphan interaction due to age: %f", fabs(creationDate.timeIntervalSinceNow));
continue;
}
} }
OWSLogInfo(@"Removing orphan message: %@", interaction.uniqueId); OWSLogInfo(@"Removing orphan message: %@", interaction.uniqueId);
interactionsRemoved++; interactionsRemoved++;

@ -218,21 +218,21 @@ NSString *const kNSUserDefaults_DatabaseExtensionVersionMap = @"kNSUserDefaults_
- (void)saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction - (void)saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{ {
[LKLogger print:@"Tried to save unknown object"]; OWSFailDebug(@"Tried to save unknown object");
// No-op. // No-op.
} }
- (void)touchWithTransaction:(YapDatabaseReadWriteTransaction *)transaction - (void)touchWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{ {
[LKLogger print:@"Tried to touch unknown object"]; OWSFailDebug(@"Tried to touch unknown object");
// No-op. // No-op.
} }
- (void)removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction - (void)removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{ {
[LKLogger print:@"Tried to remove unknown object"]; OWSFailDebug(@"Tried to remove unknown object");
// No-op. // No-op.
} }

Loading…
Cancel
Save