From ca10eef60c13c38e6423bd750c4b4b69df8c8153 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 14 Dec 2024 20:17:53 -0800 Subject: [PATCH] Turn off debug logging. Go 3 hours between attempts instead of just 1. --- RSWeb/Sources/RSWeb/HTMLMetadataDownloader.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/RSWeb/Sources/RSWeb/HTMLMetadataDownloader.swift b/RSWeb/Sources/RSWeb/HTMLMetadataDownloader.swift index 4b30e5515..4a66b2d49 100644 --- a/RSWeb/Sources/RSWeb/HTMLMetadataDownloader.swift +++ b/RSWeb/Sources/RSWeb/HTMLMetadataDownloader.swift @@ -15,7 +15,7 @@ public final class HTMLMetadataDownloader: Sendable { public static let shared = HTMLMetadataDownloader() private static let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "HTMLMetadataDownloader") - private static let debugLoggingEnabled = true + private static let debugLoggingEnabled = false private let cache = HTMLMetadataCache() private let attemptDatesLock = OSAllocatedUnfairLock(initialState: [String: Date]()) @@ -50,12 +50,13 @@ private extension HTMLMetadataDownloader { return } - // We try a download once an hour at most. + // Limit how often a download should be attempted. let shouldDownload = attemptDatesLock.withLock { attemptDates in let currentDate = Date() - if let attemptDate = attemptDates[url], attemptDate > currentDate.bySubtracting(hours: 1) { + let hoursBetweenAttempts = 3 // arbitrary + if let attemptDate = attemptDates[url], attemptDate > currentDate.bySubtracting(hours: hoursBetweenAttempts) { if Self.debugLoggingEnabled { Self.logger.debug("HTMLMetadataDownloader skipping download for \(url) because an attempt was made less than an hour ago.") }