Remove cleaning limit

This commit is contained in:
Justin Mazzocchi 2022-11-21 21:15:08 -08:00
parent 822fa06046
commit eb276c06f0

View file

@ -671,7 +671,6 @@ public extension ContentDatabase {
private extension ContentDatabase { private extension ContentDatabase {
static let cleanAfterLastReadIdCount = 40 static let cleanAfterLastReadIdCount = 40
static let cleanLimit = 100
static let ephemeralTimelines = NSCountedSet() static let ephemeralTimelines = NSCountedSet()
static func fileURL(id: Identity.Id, appGroup: String) throws -> URL { static func fileURL(id: Identity.Id, appGroup: String) throws -> URL {
@ -701,9 +700,8 @@ private extension ContentDatabase {
let statusIdsToKeep = Set(statusIds).union(reblogStatusIds) let statusIdsToKeep = Set(statusIds).union(reblogStatusIds)
let allStatusIds = try Status.Id.fetchSet(db, StatusRecord.select(StatusRecord.Columns.id)) let allStatusIds = try Status.Id.fetchSet(db, StatusRecord.select(StatusRecord.Columns.id))
let staleStatusIds = allStatusIds.subtracting(statusIdsToKeep)
return Set(Array(staleStatusIds).prefix(Self.cleanLimit)) return allStatusIds.subtracting(statusIdsToKeep)
} }
static func accountIdsToDeleteForPositionPreservingClean(db: Database) throws -> Set<Account.Id> { static func accountIdsToDeleteForPositionPreservingClean(db: Database) throws -> Set<Account.Id> {
@ -714,8 +712,7 @@ private extension ContentDatabase {
&& AccountRecord.Columns.movedId != nil) && AccountRecord.Columns.movedId != nil)
.select(AccountRecord.Columns.movedId))) .select(AccountRecord.Columns.movedId)))
let allAccountIds = try Account.Id.fetchSet(db, AccountRecord.select(AccountRecord.Columns.id)) let allAccountIds = try Account.Id.fetchSet(db, AccountRecord.select(AccountRecord.Columns.id))
let staleAccountIds = allAccountIds.subtracting(accountIdsToKeep)
return Set(Array(staleAccountIds).prefix(Self.cleanLimit)) return allAccountIds.subtracting(accountIdsToKeep)
} }
} }