mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-05 03:37:41 +00:00
Remove the download cache from the feed refresher. Now using other mechanisms to prevent excessive feed polling.
This commit is contained in:
1 parent
a187eeb92c
commit
ff623614f3
1 file changed
-20
@@ -41,7 +41,6 @@ struct HTTP4xxResponse {
|
||||
private let delegate: DownloadSessionDelegate
|
||||
private var redirectCache = [URL: URL]()
|
||||
private var queue = [URL]()
|
||||
private let cache = DownloadCache.shared
|
||||
|
||||
public var progressInfo = ProgressInfo() {
|
||||
didSet {
|
||||
@@ -137,11 +136,6 @@ extension DownloadSession: @preconcurrency URLSessionTaskDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
if let url = task.originalRequest?.url, error == nil {
|
||||
Self.logger.debug("DownloadSession: Caching response for \(url)")
|
||||
cache.add(url.absoluteString, data: info.data as Data, response: info.urlResponse)
|
||||
}
|
||||
|
||||
delegate.downloadSession(self, downloadDidComplete: info.url, response: info.urlResponse, data: info.data as Data, error: error as NSError?)
|
||||
}
|
||||
}
|
||||
@@ -184,13 +178,6 @@ extension DownloadSession: @preconcurrency URLSessionDataDelegate {
|
||||
|
||||
let statusCode = response.forcedStatusCode
|
||||
if statusCode >= 400 {
|
||||
if statusCode != HTTPResponseCode.tooManyRequests {
|
||||
if let urlString = response.url?.absoluteString {
|
||||
Self.logger.debug("DownloadSession: Caching >= 400 response for \(urlString)")
|
||||
cache.add(urlString, data: nil, response: response)
|
||||
}
|
||||
}
|
||||
|
||||
Self.logger.debug("DownloadSession: canceling task due to >= 400 response \(response)")
|
||||
|
||||
if let url = taskInfo?.url {
|
||||
@@ -252,13 +239,6 @@ private extension DownloadSession {
|
||||
return
|
||||
}
|
||||
|
||||
// Check cache
|
||||
if let cachedResponse = cache[urlToUse.absoluteString] {
|
||||
Self.logger.info("DownloadSession: using cached response for \(urlToUse) - \(cachedResponse.response?.forcedStatusCode ?? -1)")
|
||||
delegate.downloadSession(self, downloadDidComplete: url, response: cachedResponse.response, data: cachedResponse.data ?? Data(), error: nil)
|
||||
return
|
||||
}
|
||||
|
||||
let urlRequest: URLRequest = {
|
||||
var request = URLRequest(url: urlToUse)
|
||||
if let conditionalGetInfo = delegate.downloadSession(self, conditionalGetInfoFor: url) {
|
||||
|
||||
Reference in new issue
Block a user