From e6d9a33dbf44c5e7ba94fdfcb8188ac0ca0fdb5b Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 8 Jun 2024 13:18:23 -0700 Subject: [PATCH] Actually don't purge old persistent history --- .../MastodonCachePersistentStore.swift | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Tusker/CoreData/MastodonCachePersistentStore.swift b/Tusker/CoreData/MastodonCachePersistentStore.swift index b055d119..44fd8bc9 100644 --- a/Tusker/CoreData/MastodonCachePersistentStore.swift +++ b/Tusker/CoreData/MastodonCachePersistentStore.swift @@ -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. } } }