Actually don't purge old persistent history

This commit is contained in:
Shadowfacts 2024-06-08 13:18:23 -07:00
parent d8fccc8f1b
commit e6d9a33dbf
1 changed files with 5 additions and 13 deletions

View File

@ -545,20 +545,12 @@ class MastodonCachePersistentStore: NSPersistentCloudKitContainer {
}
if !transactions.isEmpty {
self.processPersistentHistoryTransactions(transactions)
do {
// delete history only before the last token, because we don't want to invalidate
// the most recent token
let deleteReq = NSPersistentHistoryChangeRequest.deleteHistory(before: lastToken)
let result = try self.remoteChangesBackgroundContext.execute(deleteReq)
if let result = result as? NSPersistentHistoryResult,
result.resultType == .statusOnly {
logger.info("Delete old persistent history result status: \(result.result as! Int)")
}
} catch {
logger.error("Unable to delete old persistent history: \(String(describing: error), privacy: .public)")
}
}
// NB: We deliberately do not purge old persistent history.
// Doing so causes the CoreData+CloudKit integration to replay all of
// the server's changes on initialization, which takes a long time
// and produces a bunch of intermediate UI updates we don't want.
}
}
}