Fix OPML import performance regression. Fix #238.

This commit is contained in:
Brent Simmons 2017-12-11 23:12:54 -08:00
parent 0b4a9f143e
commit 3eb95ce63d

View File

@ -240,22 +240,21 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
if let folder = folder { if let folder = folder {
didAddFeed = folder.addFeed(uniquedFeed) didAddFeed = folder.addFeed(uniquedFeed)
if didAddFeed {
addToFeedDictionaries(uniquedFeed)
}
} }
else { else {
if !topLevelObjectsContainsFeed(uniquedFeed) { if !topLevelObjectsContainsFeed(uniquedFeed) {
children += [uniquedFeed] children += [uniquedFeed]
addToFeedDictionaries(uniquedFeed)
dirty = true
postChildrenDidChangeNotification() postChildrenDidChangeNotification()
} }
didAddFeed = true didAddFeed = true
} }
rebuildFeedDictionaries() if didAddFeed {
return didAddFeed // TODO addToFeedDictionaries(uniquedFeed)
dirty = true
}
return didAddFeed
} }
public func createFeed(with name: String?, editedName: String?, url: String) -> Feed? { public func createFeed(with name: String?, editedName: String?, url: String) -> Feed? {
@ -301,6 +300,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
guard let children = opmlDocument.children else { guard let children = opmlDocument.children else {
return return
} }
rebuildFeedDictionaries()
importOPMLItems(children, parentFolder: nil) importOPMLItems(children, parentFolder: nil)
dirty = true dirty = true