mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-29 00:31:14 +00:00
Throw on Feedly sync-database read failures instead of returning zeros.
This commit is contained in:
1 parent
eb09940e6b
commit
0f1a00fc56
2 files changed
+15
-5
No files matched your search
@@ -323,8 +323,9 @@ import Secrets
|
||||
|
||||
do {
|
||||
return try await account.logActivity(kind: .sendArticleStatuses, successMessage: successMessage, durationIsSignificant: durationIsSignificant) { () -> Int in
|
||||
// A failed read must not read as “nothing to send” — zero would arm the no-change backoff.
|
||||
guard let syncStatuses = await syncDatabase.selectForProcessing() else {
|
||||
return 0
|
||||
throw FeedlyAccountDelegateError.databaseReadFailed
|
||||
}
|
||||
|
||||
var savedError: Error?
|
||||
@@ -1017,9 +1018,10 @@ private extension FeedlyAccountDelegate {
|
||||
let newerThan = Date().bySubtracting(days: Self.streamIngestDaysLimit)
|
||||
let (remoteUnreadIDs, truncated) = try await collectStreamIDs(for: account, resource: resource, kind: .refreshArticleStatuses, newerThan: newerThan, unreadOnly: true)
|
||||
|
||||
// A failed pending-statuses read must not be treated as “nothing pending” — that would revert pending changes.
|
||||
// A failed pending-statuses read must not read as “nothing pending” — that would
|
||||
// revert pending edits and arm the no-change backoff.
|
||||
guard let pendingArticleIDs = await syncDatabase.selectPendingReadStatusArticleIDs() else {
|
||||
return (added: 0, removed: 0)
|
||||
throw FeedlyAccountDelegateError.databaseReadFailed
|
||||
}
|
||||
let adjustedRemoteUnreadIDs = remoteUnreadIDs.subtracting(pendingArticleIDs)
|
||||
|
||||
@@ -1047,9 +1049,10 @@ private extension FeedlyAccountDelegate {
|
||||
let resource = FeedlyTagResourceID.Global.saved(for: userID)
|
||||
let (remoteStarredIDs, truncated) = try await collectStreamIDs(for: account, resource: resource, kind: .refreshArticleStatuses, unreadOnly: nil)
|
||||
|
||||
// A failed pending-statuses read must not be treated as “nothing pending” — that would revert pending changes.
|
||||
// A failed pending-statuses read must not read as “nothing pending” — that would
|
||||
// revert pending edits and arm the no-change backoff.
|
||||
guard let pendingArticleIDs = await syncDatabase.selectPendingStarredStatusArticleIDs() else {
|
||||
return (added: 0, removed: 0)
|
||||
throw FeedlyAccountDelegateError.databaseReadFailed
|
||||
}
|
||||
let adjustedRemoteStarredIDs = remoteStarredIDs.subtracting(pendingArticleIDs)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ enum FeedlyAccountDelegateError: LocalizedError {
|
||||
case addFeedInvalidFolder(String) // folderName
|
||||
case unableToRenameFeed(String, String)
|
||||
case unableToRemoveFeed(String)
|
||||
case databaseReadFailed
|
||||
|
||||
var errorDescription: String? {
|
||||
switch self {
|
||||
@@ -59,6 +60,9 @@ enum FeedlyAccountDelegateError: LocalizedError {
|
||||
case .unableToRemoveFeed(let feedName):
|
||||
let template = NSLocalizedString("Could not remove “%@”.", comment: "Feedly – Could not remove a feed.")
|
||||
return String(format: template, feedName)
|
||||
|
||||
case .databaseReadFailed:
|
||||
return NSLocalizedString("Could not read from the syncing database.", comment: "Feedly – Could not read from the syncing database.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +99,9 @@ enum FeedlyAccountDelegateError: LocalizedError {
|
||||
|
||||
case .unableToRenameFeed:
|
||||
return nil
|
||||
|
||||
case .databaseReadFailed:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user