diff --git a/Frameworks/Account/Feedly/Operations/FeedlyOperation.swift b/Frameworks/Account/Feedly/Operations/FeedlyOperation.swift index 983b6566f..8c231bc53 100644 --- a/Frameworks/Account/Feedly/Operations/FeedlyOperation.swift +++ b/Frameworks/Account/Feedly/Operations/FeedlyOperation.swift @@ -20,12 +20,14 @@ class FeedlyOperation: Operation { func didFinish() { assert(Thread.isMainThread) + assert(!isFinished, "Finished operation is attempting to finish again.") self.isExecutingOperation = false self.isFinishedOperation = true } func didFinish(_ error: Error) { assert(Thread.isMainThread) + assert(!isFinished, "Finished operation is attempting to finish again.") delegate?.feedlyOperation(self, didFailWith: error) didFinish() } diff --git a/Frameworks/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift b/Frameworks/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift index dc12aa0ae..e666ff743 100644 --- a/Frameworks/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift +++ b/Frameworks/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift @@ -24,9 +24,8 @@ final class FeedlySendArticleStatusesOperation: FeedlyOperation { } override func main() { - defer { didFinish() } - guard !isCancelled else { + didFinish() return } diff --git a/Frameworks/Account/Feedly/Operations/FeedlySetStarredArticlesOperation.swift b/Frameworks/Account/Feedly/Operations/FeedlySetStarredArticlesOperation.swift index 7edfd3c77..9814ae3e8 100644 --- a/Frameworks/Account/Feedly/Operations/FeedlySetStarredArticlesOperation.swift +++ b/Frameworks/Account/Feedly/Operations/FeedlySetStarredArticlesOperation.swift @@ -27,9 +27,8 @@ final class FeedlySetStarredArticlesOperation: FeedlyOperation { } override func main() { - defer { didFinish() } - guard !isCancelled else { + didFinish() return } diff --git a/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift b/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift index d5c8ab761..43faee339 100644 --- a/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift +++ b/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift @@ -102,6 +102,7 @@ final class FeedlySyncAllOperation: FeedlyOperation { override func main() { guard !isCancelled else { + // override of cancel calls didFinish(). return }