From 78cefecaada9360fe79c3fdb037d76beb8f54760 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 4 May 2020 17:48:53 -0500 Subject: [PATCH] Make sure we are only going after a given URL once --- Shared/Images/WebFeedIconDownloader.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Shared/Images/WebFeedIconDownloader.swift b/Shared/Images/WebFeedIconDownloader.swift index 25fae6d27..930afe8a3 100644 --- a/Shared/Images/WebFeedIconDownloader.swift +++ b/Shared/Images/WebFeedIconDownloader.swift @@ -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