mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-30 09:18:18 +00:00
Avoid failing the refresh when a single missing Miniflux entry returns HTTP error.
This commit is contained in:
1 parent
52e566033f
commit
046f712d0c
3 files changed
+26
-2
No files matched your search
@@ -910,12 +910,12 @@ private extension MinifluxAccountDelegate {
|
||||
serverDeletedArticleIDs.insert(String(entryID))
|
||||
}
|
||||
} catch {
|
||||
savedError = error
|
||||
Self.logger.error("Miniflux: Refresh missing articles error: \(error.localizedDescription)")
|
||||
// An HTTP error is about this entry, so skip it. Anything else, such as no connection, would fail every remaining request.
|
||||
// An HTTP error is about this entry, so skip it without failing the refresh. Anything else, such as no connection, would fail every remaining request.
|
||||
if case WebserviceError.httpError = error {
|
||||
continue
|
||||
}
|
||||
savedError = error
|
||||
shouldStopFetching = true
|
||||
break
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"total": 1,
|
||||
"entry_ids": [9001]
|
||||
}
|
||||
@@ -99,6 +99,26 @@ import SyncDatabase
|
||||
XCTAssertGreaterThan(TestingURLProtocol.requestCount(forURLContaining: "changed_after"), 0)
|
||||
}
|
||||
|
||||
func testMissingArticleHTTPErrorDoesNotFailRefresh() async throws {
|
||||
TestingURLProtocol.setResponse("/v1/version", file: "JSON/miniflux_version.json")
|
||||
TestingURLProtocol.setResponse("/v1/categories", file: "JSON/miniflux_categories_initial.json")
|
||||
TestingURLProtocol.setResponse("/v1/feeds", file: "JSON/miniflux_feeds_initial.json")
|
||||
TestingURLProtocol.setResponse("/v1/entries?", file: "JSON/miniflux_entries_page1.json")
|
||||
TestingURLProtocol.setResponse("/v1/entries/ids", file: "JSON/miniflux_entry_ids_missing_article.json")
|
||||
TestingURLProtocol.setResponse(.init(statusCode: 500), forURLContaining: "/v1/entries/9001")
|
||||
|
||||
let account = TestAccountManager.shared.createAccount(type: .miniflux)
|
||||
defer {
|
||||
TestAccountManager.shared.deleteAccount(account)
|
||||
}
|
||||
account.endpointURL = URL(string: "https://miniflux.test")
|
||||
|
||||
try await account.refreshAll()
|
||||
|
||||
XCTAssertGreaterThan(TestingURLProtocol.requestCount(forURLContaining: "/v1/entries/9001"), 0)
|
||||
XCTAssertNotNil(account.lastRefreshCompletedDate)
|
||||
}
|
||||
|
||||
func testInitialReconciliationPreservesPendingLocalStatus() async throws {
|
||||
let account = TestAccountManager.shared.createAccount(type: .miniflux)
|
||||
defer {
|
||||
|
||||
Reference in new issue
Block a user