mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-30 09:18:18 +00:00
Switch from daily to weekly cleanup to cut down on cost of it.
This commit is contained in:
1 parent
8df4016d81
commit
b9cc340e41
1 file changed
+4
-4
@@ -871,8 +871,8 @@ private extension CloudKitAccountDelegate {
|
||||
|
||||
func cleanUpContentRecordsIfNeeded() async {
|
||||
let lastCleanUp = UserDefaults.standard.object(forKey: Self.lastCleanUpKey) as? Date ?? .distantPast
|
||||
let oneDayAgo = Date(timeIntervalSinceNow: -24 * 60 * 60)
|
||||
guard lastCleanUp < oneDayAgo else {
|
||||
let oneWeekAgo = Date(timeIntervalSinceNow: -7 * 24 * 60 * 60)
|
||||
guard lastCleanUp < oneWeekAgo else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -884,11 +884,11 @@ private extension CloudKitAccountDelegate {
|
||||
// doing a bunch of extra work that will fail. Let it rest until the next go.
|
||||
UserDefaults.standard.set(Date(), forKey: Self.lastCleanUpKey)
|
||||
|
||||
Self.logger.info("CloudKitAccountDelegate: running daily record cleanup")
|
||||
Self.logger.info("CloudKitAccountDelegate: running weekly record cleanup")
|
||||
do {
|
||||
let syncUnreadContent = Self.syncArticleContentForUnreadArticles
|
||||
let deleted = try await articlesZone.cleanUpRecords(account: account, syncUnreadContent: syncUnreadContent, dryRun: true)
|
||||
Self.logger.info("CloudKitAccountDelegate: daily cleanup deleted \(deleted, privacy: .public) records")
|
||||
Self.logger.info("CloudKitAccountDelegate: weekly cleanup deleted \(deleted, privacy: .public) records")
|
||||
} catch {
|
||||
Self.logger.error("CloudKitAccountDelegate: daily cleanup error: \(error.localizedDescription, privacy: .public)")
|
||||
postSyncError(error, account: account, operation: "Daily record cleanup")
|
||||
|
||||
Reference in new issue
Block a user