mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 18:10:16 +00:00
Fix potential Feedbin sync bug by storing conditional GET info after, not before, updating model.
This commit is contained in:
1 parent
5e33560da4
commit
491df567a6
2 files changed
+8
-8
No files matched your search
@@ -365,7 +365,7 @@ enum CreateSubscriptionResult {
|
||||
return (entries, pagingInfo.nextPage)
|
||||
}
|
||||
|
||||
func retrieveUnreadEntries() async throws -> [Int]? {
|
||||
func retrieveUnreadEntries() async throws -> (unreadArticleIDs: [Int]?, response: HTTPURLResponse) {
|
||||
if suspended {
|
||||
throw WebserviceError.suspended
|
||||
}
|
||||
@@ -375,8 +375,7 @@ enum CreateSubscriptionResult {
|
||||
let request = URLRequest(url: callURL, credentials: credentials, conditionalGet: conditionalGet)
|
||||
|
||||
let (response, unreadEntries) = try await session.send(request: request, resultType: [Int].self)
|
||||
storeConditionalGet(key: ConditionalGetKeys.unreadEntries, response: response)
|
||||
return unreadEntries
|
||||
return (unreadEntries, response)
|
||||
}
|
||||
|
||||
func createUnreadEntries(entries: [Int]) async throws {
|
||||
@@ -403,7 +402,7 @@ enum CreateSubscriptionResult {
|
||||
try await session.send(request: request, method: HTTPMethod.delete, payload: payload)
|
||||
}
|
||||
|
||||
func retrieveStarredEntries() async throws -> [Int]? {
|
||||
func retrieveStarredEntries() async throws -> (starredArticleIDs: [Int]?, response: HTTPURLResponse) {
|
||||
if suspended {
|
||||
throw WebserviceError.suspended
|
||||
}
|
||||
@@ -413,8 +412,7 @@ enum CreateSubscriptionResult {
|
||||
let request = URLRequest(url: callURL, credentials: credentials, conditionalGet: conditionalGet)
|
||||
|
||||
let (response, starredEntries) = try await session.send(request: request, resultType: [Int].self)
|
||||
storeConditionalGet(key: ConditionalGetKeys.starredEntries, response: response)
|
||||
return starredEntries
|
||||
return (starredEntries, response)
|
||||
}
|
||||
|
||||
func createStarredEntries(entries: [Int]) async throws {
|
||||
|
||||
@@ -157,16 +157,18 @@ public enum FeedbinAccountDelegateError: String, Error, Sendable {
|
||||
var refreshError: Error?
|
||||
|
||||
do {
|
||||
let articleIDs = try await caller.retrieveUnreadEntries()
|
||||
let (articleIDs, response) = try await caller.retrieveUnreadEntries()
|
||||
changedCount += await self.syncArticleReadState(account: account, articleIDs: articleIDs)
|
||||
caller.storeConditionalGet(key: FeedbinAPICaller.ConditionalGetKeys.unreadEntries, response: response)
|
||||
} catch {
|
||||
refreshError = error
|
||||
Self.logger.error("Feedbin: Retrieving unread entries failed: \(error.localizedDescription)")
|
||||
}
|
||||
|
||||
do {
|
||||
let articleIDs = try await caller.retrieveStarredEntries()
|
||||
let (articleIDs, response) = try await caller.retrieveStarredEntries()
|
||||
changedCount += await self.syncArticleStarredState(account: account, articleIDs: articleIDs)
|
||||
caller.storeConditionalGet(key: FeedbinAPICaller.ConditionalGetKeys.starredEntries, response: response)
|
||||
} catch {
|
||||
refreshError = error
|
||||
Self.logger.error("Feedbin: Retrieving starred entries failed: \(error.localizedDescription)")
|
||||
|
||||
Reference in new issue
Block a user