Resume databases for all accounts before resuming anything else, so that notifications don’t trigger database calls.
This commit is contained in:
parent
3c8c346ce7
commit
a5c1341b0c
|
@ -417,9 +417,15 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||
opmlFile.suspend()
|
||||
}
|
||||
|
||||
public func resume() {
|
||||
/// Re-open the SQLite database and allow database calls.
|
||||
/// Call this *before* calling resume.
|
||||
public func resumeDatabaseAndDelegate() {
|
||||
database.resume()
|
||||
delegate.resume()
|
||||
}
|
||||
|
||||
/// Reload OPML, etc.
|
||||
public func resume() {
|
||||
metadataFile.resume()
|
||||
webFeedMetadataFile.resume()
|
||||
opmlFile.resume()
|
||||
|
@ -481,6 +487,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||
for feed in flattenedWebFeeds() {
|
||||
feed.metadata = webFeedMetadata(feedURL: feed.url, webFeedID: feed.webFeedID)
|
||||
}
|
||||
precondition(!database.isSuspended)
|
||||
fetchAllUnreadCounts()
|
||||
NotificationCenter.default.post(name: .WebFeedMetadataDidChange, object: self, userInfo: nil)
|
||||
}
|
||||
|
|
|
@ -175,6 +175,7 @@ public final class AccountManager: UnreadCountProvider {
|
|||
|
||||
public func resumeAll() {
|
||||
isSuspended = false
|
||||
accounts.forEach { $0.resumeDatabaseAndDelegate() }
|
||||
accounts.forEach { $0.resume() }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue