mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-29 16:54:12 +00:00
Remove the minimum for cache-control max-age, since we’re enforcing a minimum elsewhere.
This commit is contained in:
1 parent
87f360bf90
commit
90600a8008
2 files changed
+8
-9
No files matched your search
@@ -302,10 +302,10 @@ private extension LocalAccountRefresher {
|
||||
return true
|
||||
}
|
||||
|
||||
// All other feeds: honor Cache-Control with clamped max-age
|
||||
// (min 30 minutes, max 5 hours) because many sites misconfigure it.
|
||||
// We’ve seen max-age as long as one year (for a feed that updates frequently).
|
||||
if !cacheControlInfo.canResume(minMaxAge: minimumTimeBetweenChecks, maxMaxAge: cacheControlMaxMaxAge) {
|
||||
// All other feeds: honor Cache-Control with a max max-age
|
||||
// because many sites misconfigure it. We’ve seen max-age as
|
||||
// long as one year (for a feed that updates frequently).
|
||||
if !cacheControlInfo.canResume(maxMaxAge: cacheControlMaxMaxAge) {
|
||||
Self.logger.info("LocalAccountRefresher: Dropping request for Cache-Control reasons: \(feed.url)")
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -22,14 +22,13 @@ public struct CacheControlInfo: Codable, Equatable, Sendable {
|
||||
Date() >= resumeDate
|
||||
}
|
||||
|
||||
/// canResume with a clamped maxAge — the actual maxAge
|
||||
/// is clamped to [minMaxAge, maxMaxAge]. We do this because
|
||||
/// canResume with a maximum maxAge. We do this because
|
||||
/// sites tend to misconfigure their max age — we’ve seen
|
||||
/// feeds that make this as long as one year, which is
|
||||
/// clearly not intentional.
|
||||
public func canResume(minMaxAge: TimeInterval, maxMaxAge: TimeInterval) -> Bool {
|
||||
let clampedMaxAge = max(minMaxAge, min(maxMaxAge, maxAge))
|
||||
return Date() >= dateCreated + clampedMaxAge
|
||||
public func canResume(maxMaxAge: TimeInterval) -> Bool {
|
||||
let maxAgeToUse = min(maxMaxAge, maxAge)
|
||||
return Date() >= dateCreated + maxAgeToUse
|
||||
}
|
||||
|
||||
public init(dateCreated: Date, maxAge: TimeInterval) {
|
||||
|
||||
Reference in new issue
Block a user