Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 96da091e9b
commit 762f915179

@ -31,6 +31,11 @@
// * Orphan attachments (with no message).
// * Orphan attachment files (with no attachment).
// * Missing attachment files (cannot be cleaned up).
// These are attachments which have no file on disk. They should be extremely rare -
// the only cases I have seen are probably due to debugging.
// They can't be cleaned up - we don't want to delete the TSAttachmentStream or
// its corresponding message. Better that the broken message shows up in the
// conversation view.
+ (void)auditAndCleanup:(BOOL)shouldCleanup
{
NSString *attachmentsFolder = [TSAttachmentStream attachmentsFolder];
@ -152,7 +157,10 @@
// being created/written, so we don't clean up anything recent.
const NSTimeInterval kMinimumOrphanAge = 15 * 60.f;
if (shouldCleanup) {
if (!shouldCleanup) {
return;
}
[databaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
for (NSString *interactionId in orphanInteractionIds) {
TSInteraction *interaction = [TSInteraction fetchObjectWithUniqueID:interactionId];
@ -207,7 +215,6 @@
}
}
}
}
+ (void)printPaths:(NSArray<NSString *> *)paths label:(NSString *)label
{

Loading…
Cancel
Save