From 1a1ee0fa17d54dd11e02678a4d3bc0c49d76ff99 Mon Sep 17 00:00:00 2001 From: Kiel Gillard Date: Wed, 6 Nov 2019 11:22:10 +1100 Subject: [PATCH] Fixes an issue where sending article statuses to Feedly was finishing prematurely. --- Frameworks/Account/Feedly/Operations/FeedlyOperation.swift | 2 ++ .../Feedly/Operations/FeedlySendArticleStatusesOperation.swift | 3 +-- .../Feedly/Operations/FeedlySetStarredArticlesOperation.swift | 3 +-- .../Account/Feedly/Operations/FeedlySyncAllOperation.swift | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) 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 }