Make sure we are only going after a given URL once

This commit is contained in:
Maurice Parker 2020-05-04 17:48:53 -05:00
parent cd4b3260b7
commit 78cefecaad
1 changed files with 6 additions and 0 deletions

View File

@ -119,7 +119,13 @@ public final class WebFeedIconDownloader {
}
if let components = URLComponents(string: feed.url), let feedProvider = FeedProviderManager.shared.best(for: components) {
guard !urlsInProgress.contains(feed.url) else {
return nil
}
urlsInProgress.insert(feed.url)
feedProvider.iconURL(components) { result in
self.urlsInProgress.remove(feed.url)
switch result {
case .success(let feedProviderURL):
self.feedURLToIconURLCache[feed.url] = feedProviderURL