mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Skip downloading favicons for a home page if it’s already in progress.
This commit is contained in:
@@ -37,6 +37,8 @@ public protocol FaviconDownloaderDelegate {
|
||||
private var remainingFaviconURLs = [String: ArraySlice<String>]() // homePageURL: array of faviconURLs that haven't been checked yet
|
||||
private var currentHomePageHasOnlyFaviconICO = false
|
||||
|
||||
private var homePageURLsInProgress = Set<String>()
|
||||
|
||||
private var homePageToFaviconURLCache = [String: String]() //homePageURL: faviconURL
|
||||
private var homePageToFaviconURLCachePath: URL
|
||||
private var homePageToFaviconURLCacheDirty = false {
|
||||
@@ -144,8 +146,17 @@ public protocol FaviconDownloaderDelegate {
|
||||
return favicon(with: faviconURL, homePageURL: url)
|
||||
}
|
||||
|
||||
guard !homePageURLsInProgress.contains(homePageURL) else {
|
||||
return nil
|
||||
}
|
||||
homePageURLsInProgress.insert(homePageURL)
|
||||
|
||||
Task { @MainActor in
|
||||
|
||||
defer {
|
||||
homePageURLsInProgress.remove(homePageURL)
|
||||
}
|
||||
|
||||
if let faviconURLs = await findFaviconURLs(with: url) {
|
||||
|
||||
// If the site explicitly specifies favicon.ico, it will appear twice.
|
||||
|
||||
Reference in New Issue
Block a user