diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index 16a7459ea..76d32af9b 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -60,8 +60,8 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, public var dirty = false { didSet { - if dirty { - Account.saveQueue.add(self, #selector(saveToDiskIfNeeded)) + if dirty && !refreshInProgress { + queueSaveToDiskIfNeeded() } } } @@ -82,6 +82,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } else { NotificationCenter.default.post(name: .AccountRefreshDidFinish, object: self) + queueSaveToDiskIfNeeded() } } } @@ -494,6 +495,11 @@ private extension Account { static let unreadCount = "unreadCount" } + func queueSaveToDiskIfNeeded() { + + Account.saveQueue.add(self, #selector(saveToDiskIfNeeded)) + } + func object(with diskObject: [String: Any]) -> AnyObject? { if Feed.isFeedDictionary(diskObject) {